def METHOD_NAME(self, instance, validated_data):
    """
    Update notification preference config.
    """
    notification_app = validated_data.get('notification_app')
    notification_type = validated_data.get('notification_type')
    notification_channel = validated_data.get('notification_channel')
    value = validated_data.get('value')
    user_notification_preference_config = instance.notification_preference_config
    if notification_type and notification_channel:
        # Update the notification preference for specific notification type
        user_notification_preference_config[
            notification_app]['notification_types'][notification_type][notification_channel] = value
    else:
        # Update the notification preference for notification_app
        user_notification_preference_config[notification_app]['enabled'] = value
    instance.save()
    return instance