class FeatureService {

    public void update(List<FeatureDTO> featuresToUpdate) throws NotFoundException {
        String codeInErrors = featuresToUpdate.stream()
                .filter(feature -> !this.featureCollection.get(feature.getCode()).isPresent())
                .map(FeatureDTO::getCode)
                .collect(Collectors.joining(", "));
        if (!codeInErrors.isEmpty()) {
            throw new NotFoundException("Unknown feature(s) '" + codeInErrors + "'.", Entities.FEATURE);
        }
        featuresToUpdate.forEach(feature -> this.featureActivator.changeStateOf(feature.getCode(), feature.isEnabled()));
    }

}