move sorting and rating business logic back to the model