class OutlineDistiller {

    public void appendRelevantOutlineTo(PDOutlineNode to, LookupTable<PDPage> pagesLookup) {
        requireNonNull(to, "Unable to merge relevant outline items to a null outline.");
        if (!pagesLookup.isEmpty()) {
            ofNullable(document.getDocumentCatalog().getDocumentOutline()).ifPresent(outline -> {
                for (PDOutlineItem child : outline.children()) {
                    cloneNode(child, pagesLookup).ifPresent(c -> to.addLast(c));
                }
                LOG.debug("Appended relevant outline items");
            });
        }
    }

    public  OutlineDistiller(PDDocument document);

}