Added utils fn: group by