Sorting dtos and consolidating into one function.