class ProjectScreenServiceImpl implements ProjectScreenService {

    @Override
    public void copy(final WorkspaceProject project,
                     final String newName) {

        String newUniqueName = projectService.createFreshProjectName(project.getOrganizationalUnit(),
                                                                     newName);

        final Repository copy = repositoryCopier.copy(project.getOrganizationalUnit(),
                                                      newName,
                                                      project.getRootPath());

        if (!copy.getDefaultBranch().isPresent()) {
            throw new IllegalStateException("Copy should have at least one branch.");
        }

        final Path newPomPath = Paths.convert(Paths.convert(copy.getDefaultBranch().get().getPath()).resolve("pom.xml"));
        final POM pom = pomService.load(newPomPath);

        if (pom != null) {
            pom.setName(newUniqueName);
            pom.getGav().setArtifactId(newName);

            pomService.save(newPomPath,
                            pom,
                            metadataService.getMetadata(newPomPath),
                            "Renaming the project.",
                            true);

            WorkspaceProject newProject = projectService.resolveProject(copy);

            newProjectEvent.fire(new NewProjectEvent(newProject));
        }
    }

    public  ProjectScreenServiceImpl();
    @Inject public  ProjectScreenServiceImpl(final WorkspaceProjectService projectService,
                                    final RepositoryService repositoryService,
                                    final KieModuleService moduleService,
                                    final ProjectScreenModelLoader loader,
                                    final ProjectScreenModelSaver saver,
                                    final RepositoryCopier repositoryCopier,
                                    final POMService pomService,
                                    final MetadataService metadataService,
                                    final Event<NewProjectEvent> newProjectEvent);

}