class HandicapGroupSetService extends AbstractEntityService<
        HandicapGroupSet,
        HandicapGroupSetAddPayload,
        HandicapGroupSetGateway> {

    @Override
    public HandicapGroupSet add(HandicapGroupSetAddPayload addPayload) throws AddEntityException {
        ImmutableSet.Builder<HandicapGroup> handicapGroupBuilder = ImmutableSet.builder();
        try {
            for (String handicapGroupId : addPayload.getHandicapGroupIds()) {
                handicapGroupBuilder.add(handicapGroupEntityService.getById(handicapGroupId));
            }
        } catch (EntityNotFoundException e) {
            throw new AddEntityException(e);
        }
        addPayload.setHandicapGroups(handicapGroupBuilder.build());
        return gateway.add(addPayload);
    }

    @Inject public  HandicapGroupSetService(
            HandicapGroupSetGateway gateway,
            HandicapGroupEntityService handicapGroupEntityService
    );

}