Remove sort function based on members() and do a single db query instead