Sort categories before returning them to client