class BaseAppSetup {

    protected void setupConfigurationGroup(ConfigType configType,
                                           String configGroupName,
                                           ConfigGroup configGroup,
                                           ConfigItem... configItemsToSetManually) {
        List<ConfigGroup> existentConfigGroups = configurationService.getConfiguration(configType);
        boolean settingsDefined = false;

        for (ConfigGroup existentConfigGroup : existentConfigGroups) {
            if (configGroupName.equals(existentConfigGroup.getName())) {
                settingsDefined = true;

                if (configItemsToSetManually != null) {
                    for (ConfigItem configItem : configItemsToSetManually) {
                        ConfigItem existentConfigItem = existentConfigGroup.getConfigItem(configItem.getName());
                        if (existentConfigItem == null) {
                            existentConfigGroup.addConfigItem(configItem);
                            configurationService.updateConfiguration(existentConfigGroup);
                        } else if (!existentConfigItem.getValue().equals(configItem.getValue())) {
                            existentConfigItem.setValue(configItem.getValue());
                            configurationService.updateConfiguration(existentConfigGroup);
                        }
                    }
                }

                break;
            }
        }

        if (!settingsDefined) {
            configurationService.addConfiguration(configGroup);
        }
    }

    protected  BaseAppSetup();
    public  BaseAppSetup(final IOService ioService,
                        final RepositoryService repositoryService,
                        final OrganizationalUnitService organizationalUnitService,
                        final KieModuleService moduleService,
                        final ConfigurationService configurationService,
                        final ConfigurationFactory configurationFactory);

}