class FileSystemDeleteWorker {

    protected void removeSpaceDirectory(final Space space) {
        try {

            Collection<Repository> repositories = this.repositoryService.getAllRepositories(space,
                                                                                            true);

            repositories.forEach(repository -> this.removeRepository(repository));

            SpaceConfigStorageImpl configStorage = (SpaceConfigStorageImpl) this.registry.get(space.getName());
            final Path configPath = configStorage.getPath();

            final File spacePath = getSpacePath(configPath.getFileSystem().getPath("/"));
            final Path configFSPath = configPath.getFileSystem().getPath("/");
            this.ioService.deleteIfExists(configFSPath);
            this.registry.remove(space.getName());
            this.delete(spacePath);
            this.removeSpaceFromConfigurationService(space);
        } catch (Exception e) {
            ifDebugEnabled(logger,
                           () -> logger.error("A problem occurred when trying to delete " + space.getName() + " space",
                                              e));
        }
    }

    public  FileSystemDeleteWorker();
    @Inject public  FileSystemDeleteWorker(@Named("ioStrategy") final IOService ioService,
                                  final OrganizationalUnitService organizationalUnitService,
                                  final RepositoryService repositoryService,
                                  final @Named("systemFS") FileSystem systemFS,
                                  final SpaceConfigStorageRegistry registry,
                                  final Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent,
                                  final ConfigurationService configurationService);

}