@Override
    public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
        for(Path file : files.keySet()) {
            callback.delete(file);
            try {
                if(file.attributes().isDuplicate()) {
                    // Already trashed
                    log.warn(String.format("Delete file %s already in trash", file));
                    new NodesApi(session.getClient()).removeDeletedNodes(new DeleteDeletedNodesRequest().deletedNodeIds(Collections.singletonList(
                            Long.parseLong(nodeid.getVersionId(file)))), StringUtils.EMPTY);
                }
                else if(file.attributes().getVerdict() == PathAttributes.Verdict.malicious) {
                    // Delete malicious file
                    log.warn(String.format("Delete file %s marked as malicious", file));
                    new NodesApi(session.getClient()).removeMaliciousFile(
                            Long.parseLong(nodeid.getVersionId(file)), StringUtils.EMPTY);
                }
                else {
                    new NodesApi(session.getClient()).removeNode(
                            Long.parseLong(nodeid.getVersionId(file)), StringUtils.EMPTY);
                }
                nodeid.cache(file, null);
            }
            catch(ApiException e) {
                throw new SDSExceptionMappingService(nodeid).map("Cannot delete {0}", e, file);
            }
        }
    }
@Test
    public void testDeleteFolderRoomWithContent() throws Exception {
        final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
        final Path room = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(
                new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume)), new TransferStatus());
        final Path folder = new SDSDirectoryFeature(session, nodeid).mkdir(new Path(room,
                new AlphanumericRandomStringService().random().toLowerCase(), EnumSet.of(Path.Type.directory)), new TransferStatus());
        assertTrue(new DefaultFindFeature(session).find(folder));
        final Path file = new Path(folder, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file));
        new SDSTouchFeature(session, nodeid).touch(file, new TransferStatus());
        assertTrue(new DefaultFindFeature(session).find(file));
        new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new DefaultFindFeature(session).find(folder));
        new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback());
        assertFalse(new DefaultFindFeature(session).find(room));
    }