Refactor user controller into a search_and_sort method