class DemoService {

    public void delete() throws NotFoundException {
        final Project project = projectRepository.findOneByCode(PROJECT_CODE_DEMO);
        if (project == null) {
            throw new NotFoundException(Messages.NOT_FOUND_PROJECT, Entities.PROJECT);
        }

        final String executionBasePath = settingService.get(project.getId().longValue(),
                Settings.EXECUTION_INDEXER_FILE_EXECUTION_BASE_PATH);

        projectRepository.delete(project);

        if (executionBasePath.contains(Settings.PROJECT_VARIABLE)) {
            final String projectExecutionsFolder = executionBasePath
                    .replace(Settings.PROJECT_VARIABLE, PROJECT_CODE_DEMO)
                    .replace(Settings.BRANCH_VARIABLE, "")
                    .replace(Settings.CYCLE_VARIABLE, "");
            try {
                FileUtils.deleteDirectory(new File(projectExecutionsFolder));
            } catch (IOException e) {
                log.error("Cannot delete the temporary directory for the demo project's executions: " +
                        projectExecutionsFolder, e);
            }
        }
    }

}