Refactor validation in admin_add() and admin_edit()