Refactoring controllers check_sorting_params