@Override
    public boolean export(final File target, HistorySorter sorter) {
        boolean result = false;

        if (sorter == null) {
            throw new IllegalArgumentException("Null sorter not allowed");
        }

        try {
            final Document doc = prepareDocument();
            final Element rootElement = doc.createElement("History");
            doc.appendChild(rootElement);
            final List<Element> data = sorter.sortHistory(records, doc);
            for (Element e : data) {
                rootElement.appendChild(e);
            }
            exportDocumentToXML(target, doc);
            result = true;

            LOG.log(Level.FINE, "History successfully exported to {0}, sorted using {1}", new Object[]{target.getAbsolutePath(), sorter.getClass().getCanonicalName()});
        } catch (TransformerConfigurationException ex) {
            LOG.log(Level.WARNING, "Failed to create Transformer, export failed.");
            LOG.log(Level.FINE, "Failed to create Transformer.", ex);
        } catch (TransformerException ex) {
            LOG.log(Level.WARNING, "Failed to transform history into XML, export failed.");
            LOG.log(Level.FINE, "Failed to transform history into XML.", ex);
        } catch (ParserConfigurationException ex) {
            LOG.log(Level.WARNING, "Failed to create DocumentBuilder, export failed.");
            LOG.log(Level.FINE, "Failed to create DocumentBuilder.", ex);
        }

        return result;
    }