                  setattr(obj, field_name, sub_object)
  
          obj.save(**kwargs)
  
          if self.allow_add_remove and hasattr(obj, '_removed_relations'):
              [self.delete_object(item) for item in obj._removed_relations]
  
          if getattr(obj, '_m2m_data', None):
              for accessor_name, object_list in obj._m2m_data.items():
                  setattr(obj, accessor_name, object_list)
              del(obj._m2m_data)
  
 
</s> remove         if self.allow_add_remove and hasattr(obj, '_removed_relations'):
            [self.delete_object(item) for item in obj._removed_relations]

 </s> add  </s> remove         if self.allow_add_remove and self._deleted:
            [self.delete_object(item) for item in self._deleted]
 </s> add             if self.allow_add_remove and self.object._deleted:
                [self.delete_object(item) for item in self.object._deleted]
        else:
            self.save_object(self.object, **kwargs)         </s> remove         else:
            self.save_object(self.object, **kwargs)
 </s> add  </s> remove         # Deleted related objects
        if self._deleted:
            removed_relations = list(self._deleted)

 </s> add 
                  setattr(obj, field_name, sub_object)
  
          obj.save(**kwargs)
  



          if getattr(obj, '_m2m_data', None):
              for accessor_name, object_list in obj._m2m_data.items():
                  setattr(obj, accessor_name, object_list)
              del(obj._m2m_data)
  
keep keep keep keep replace replace replace keep keep keep keep keep
 Fix model serializer nestesd delete behavior 
rest_framework/serializers.py