List<Group> matchingGroups = groupService.search(context, "COMMUNITY\\_" + community.getID() + "\\_"); for (Group g : matchingGroups) { if (!list.contains(g)) { List<Group> matchingGroups = groupService.search(context, "COLLECTION\\_" + collection.getID() + "\\_"); for (Group g : matchingGroups) { if (!list.contains(g)) {