          # as they require that the instance has already been saved.
          info = model_meta.get_field_info(ModelClass)
          many_to_many = {}
          for field_name, relation_info in info.relations.items():
              if relation_info.to_many and (field_name in attrs):
                  many_to_many[field_name] = attrs.pop(field_name)
  
          instance = ModelClass.objects.create(**attrs)
  
          # Save many-to-many relationships after the instance is created.
          if many_to_many:
 
</s> remove         instance = ModelClass.objects.create(**attrs)
 </s> add         instance = ModelClass.objects.create(**validated_attrs) </s> remove         # Remove many-to-many relationships from attrs.
 </s> add         # Remove many-to-many relationships from validated_attrs. </s> remove     def create(self, attrs):
 </s> add     def create(self, validated_attrs): </s> remove         instance.delete()
 </s> add         self.perform_destroy(instance)
            if relation_info.to_many and (field_name in validated_attrs):
                many_to_many[field_name] = validated_attrs.pop(field_name)
          # as they require that the instance has already been saved.
          info = model_meta.get_field_info(ModelClass)
          many_to_many = {}
          for field_name, relation_info in info.relations.items():
            if relation_info.to_many and (field_name in validated_attrs):
                many_to_many[field_name] = validated_attrs.pop(field_name)
            if relation_info.to_many and (field_name in validated_attrs):
                many_to_many[field_name] = validated_attrs.pop(field_name)
  
          instance = ModelClass.objects.create(**attrs)
  
          # Save many-to-many relationships after the instance is created.
          if many_to_many:
keep keep keep keep replace replace keep keep keep keep keep
 Tweak pre/post save hooks. Return instance in .update(). 
rest_framework/serializers.py