class ScenarioUploader {

    public void assignWrongCountryCodes(List<String> countryCodes, List<Scenario> scenarios) {
        for (Scenario scenario : scenarios) {
            StringBuilder builder = new StringBuilder();
            for (String countryCode : scenario.getCountryCodes().split(Scenario.COUNTRY_CODES_SEPARATOR)) {
                if (!countryCodes.contains(countryCode)) {
                    builder.append(builder.length() == 0 ? "" : ",").append(countryCode);
                }
            }
            scenario.setWrongCountryCodes(builder.length() == 0 ? null : builder.toString());
        }
    }

}