Instead of calling `count()` on results, adjust query to do the count on database, you don't use anywhere else this new query.