@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        try {
            final Ds3Client client = new SpectraClientBuilder().wrap(session.getClient(), session.getHost());
            final Map<Path, TransferStatus> filtered = new LinkedHashMap<>(files);
            for(Iterator<Map.Entry<Path, TransferStatus>> iter = filtered.entrySet().iterator(); iter.hasNext(); ) {
                final Map.Entry<Path, TransferStatus> file = iter.next();
                if(containerService.isContainer(file.getKey())) {
                    client.deleteBucketSpectraS3(
                            new DeleteBucketSpectraS3Request(containerService.getContainer(file.getKey()).getName()).withForce(true));
                    iter.remove();
                }
                else if(file.getKey().isDirectory()) {
                    client.deleteFolderRecursivelySpectraS3(
                            new DeleteFolderRecursivelySpectraS3Request(
                                    containerService.getContainer(file.getKey()).getName(),
                                    containerService.getKey(file.getKey())));
                    iter.remove();
                }
            }
            final Map<Path, List<Path>> containers = new HashMap<>();
            for(Path file : filtered.keySet()) {
                final Path bucket = containerService.getContainer(file);
                if(containers.containsKey(bucket)) {
                    containers.get(bucket).add(file);
                }
                else {
                    containers.put(bucket, new ArrayList<>(Collections.singletonList(file)));
                }
            }
            for(Map.Entry<Path, List<Path>> entry : containers.entrySet()) {
                final List<String> keys = entry.getValue().stream().map(containerService::getKey).collect(Collectors.toList());
                client.deleteObjects(new DeleteObjectsRequest(containerService.getContainer(entry.getKey()).getName(), keys));
            }
        }
        catch(FailedRequestException e) {
            throw new SpectraExceptionMappingService().map(e);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e);
        }
    }
@Test
    public void testDeleteContainer() throws Exception {
        final Path container = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.volume, Path.Type.directory));
        container.attributes().setRegion("US");
        new SpectraDirectoryFeature(session, new SpectraWriteFeature(session)).mkdir(container, new TransferStatus());
        assertTrue(new SpectraFindFeature(session).find(container));
        new SpectraDeleteFeature(session).delete(Collections.singletonList(container), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }