After some comments from tridge, clean the new usergroups code into a helper