Refactor group querying into a cacheable method