class ProjectScreenModelSaver {

    public void save(final Path pathToPomXML,
                     final ProjectScreenModel model,
                     final DeploymentMode mode,
                     final String comment) {
        if (DeploymentMode.VALIDATED.equals(mode)) {
            checkRepositories(pathToPomXML,
                              model);
        }

        try {
            final KieModule module = moduleService.resolveModule(pathToPomXML);
            pomModelCache.invalidateCache(module);

            ioService.startBatch(Paths.convert(pathToPomXML).getFileSystem(),
                                 commentedOptionFactory.makeCommentedOption(comment));
            pomService.save(pathToPomXML,
                            model.getPOM(),
                            model.getPOMMetaData(),
                            comment);
            kModuleService.save(model.getPathToKModule(),
                                model.getKModule(),
                                model.getKModuleMetaData(),
                                comment);
            importsService.save(model.getPathToImports(),
                                model.getProjectImports(),
                                model.getProjectImportsMetaData(),
                                comment);
            repositoriesService.save(model.getPathToRepositories(),
                                     model.getRepositories(),
                                     comment);
            whiteListService.save(model.getPathToWhiteList(),
                                  model.getWhiteList(),
                                  model.getWhiteListMetaData(),
                                  comment);
        } catch (final Exception e) {
            throw new RuntimeException(e);
        } finally {
            ioService.endBatch();
        }
    }

    public  ProjectScreenModelSaver();
    @Inject public  ProjectScreenModelSaver(final POMService pomService,
                                   final KModuleService kModuleService,
                                   final ProjectImportsService importsService,
                                   final ModuleRepositoriesService repositoriesService,
                                   final PackageNameWhiteListService whiteListService,
                                   final @Named("ioStrategy") IOService ioService,
                                   final KieModuleService moduleService,
                                   final ModuleRepositoryResolver repositoryResolver,
                                   final CommentedOptionFactory commentedOptionFactory,
                                   final LRUPomModelCache pomModelCache);

}