I'm developing a system in which a ClassA object can have multiple ClassB and ClassC objects.

And for store these objects in a relational DB model I create the following tables:

This is a simplified example of the real system.
My problem arises when I need to update ClassA objects because I need to check if the modified object has more ClassA and ClassB objects or less and then update the ClassA table and add, update or delete corresponding rows from ClassBObjectsPerClassAObject and ClassCObjectsPerClassAObject tables. So my approach was to keep the original object unmodified in the persistence layer until the modified object comes back from the interface and then compare them, but with this approach, all objects need to be duplicated. Is there a better approach, method, or design pattern that I can use for this kind of problem?
I'm using Python with SQLAlchemy and MySql in the persistence layer, flask in the services layer, and Angular in the frontend