Refactoring user belongs to group function