refactoring of  the users controller