def update(self, instance, validated_data):
    links = validated_data.pop('links')
    with transaction.atomic():
        instance = super().update(instance, validated_data)
        instance.update_links(links)
    return instance
def update(self, instance, validated_data):
    links = validated_data.pop('links')
    with transaction.atomic():
        instance = super().update(instance, validated_data)
        instance.update_links(links)
    return instance