@Override
    public BulkActionResult delete(final List<ExplorerNode> explorerNodes) {
        final List<ExplorerNode> resultNodes = new ArrayList<>();
        final StringBuilder resultMessage = new StringBuilder();

        // Fire the PRE_DELETE event so listeners can find ancestors of
        // the nodes before they disappear from the Explorer
        explorerNodes.forEach(explorerNode ->
                EntityEvent.fire(entityEventBus, explorerNode.getDocRef(), EntityAction.PRE_DELETE));

        final HashSet<ExplorerNode> deleted = new HashSet<>();
        explorerNodes.forEach(explorerNode -> {
            // Check this document hasn't already been deleted.
            if (!deleted.contains(explorerNode)) {
                recursiveDelete(explorerNodes, deleted, resultNodes, resultMessage);
            }
        });

        // The action handlers may fire DELETE events, but in case they don't
        resultNodes.stream()
                .filter(Objects::nonNull)
                .map(ExplorerNode::getDocRef)
                .forEach(docRef ->
                        EntityEvent.fire(entityEventBus, docRef, EntityAction.DELETE_EXPLORER_NODE));

        return new BulkActionResult(resultNodes, resultMessage.toString());
    }
Create a map of folders and their child items.
stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/ExplorerServiceImpl.java