Generalize some methods in AccountController and UserManagementController.