the add/edit provider click action has become more complex with the client-side validation, split it out in its own top-level function