class CompetitionGroupSetService extends AbstractEntityService<
        CompetitionGroupSet,
        CompetitionGroupSetAddPayload,
        CompetitionGroupSetGateway> {

    @Override
    public CompetitionGroupSet add(CompetitionGroupSetAddPayload addPayload) throws AddEntityException {
        ImmutableSet.Builder<CompetitionGroup> competitionGroupsBuilder = ImmutableSet.builder();
        try {
            for (String competitionGroupId : addPayload.getCompetitionGroupIds()) {
                competitionGroupsBuilder.add(competitionGroupEntityService.getById(competitionGroupId));
            }
        } catch (EntityNotFoundException e) {
            throw new AddEntityException(e);
        }
        addPayload.setCompetitionGroups(competitionGroupsBuilder.build());
        return gateway.add(addPayload);
    }

    @Inject public  CompetitionGroupSetService(
            CompetitionGroupSetGateway gateway,
            CompetitionGroupEntityService competitionGroupEntityService);

}