implementing smart save - only save objects that have changed