def create(self, validated_data):
    phones_data = validated_data.pop('phones', [])
user = super(UserSerializer, self).create(validated_data)
for phone_data in phones_data:
    user.phone_set.create(phone_number=phone_data['phone_number'])
return user

def update(self, instance, validated_data):
    phones_data = validated_data.pop('phones', [])
user = super(UserSerializer, self).update(instance, validated_data)
user.phone_set.exclude(phone__in=[p['phone_number'] for p in phones_data]
    ).delete()
for phone_data in phones_data:
    user.phone_set.get_or_create(phone_number=phone_data['phone_number'])
return user
django rest framework nested fields with multiple models