Simplify 'edit' endpoint if block