public void store(String filename, RoutingTable routingTable) throws FileNotFoundException {
        FileOutputStream outStream = null;
        try {
            outStream = new FileOutputStream(filename);

            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
            XMLEventWriter eventWriter = outputFactory
                    .createXMLEventWriter(outStream);

            XMLEventFactory eventFactory = XMLEventFactory.newInstance();
            XMLEvent end = eventFactory.createDTD("\n");
            XMLEvent tab = eventFactory.createDTD("\t");
            XMLEvent doubleTab = eventFactory.createDTD("\t\t");

            StartDocument startDocument = eventFactory.createStartDocument();
            eventWriter.add(startDocument);
            eventWriter.add(end);

            StartElement rtStartElement = eventFactory.createStartElement("", "", ROOT);
            eventWriter.add(rtStartElement);
            eventWriter.add(end);


            int levelIndex = 0;

            Host localpeer = routingTable.getLocalhost();
            StartElement localPeerStartElement = eventFactory.createStartElement("", "", LOCALPEER);
            eventWriter.add(tab);
            eventWriter.add(localPeerStartElement);
            eventWriter.add(end);

            createNode(eventWriter, doubleTab, ADDRESS, localpeer.getAddress().getHostName());
            createNode(eventWriter, doubleTab, PORT, Integer.toString(localpeer.getPort()));
            String xmlPath = localpeer.getHostPath().toString();
            createNode(eventWriter, doubleTab, PATH, (xmlPath.isEmpty() ? " " : xmlPath));
            createNode(eventWriter, doubleTab, TIMESTAMP, Long.toString(localpeer.getTimestamp()));
            createNode(eventWriter, doubleTab, UUID_STR, localpeer.getUUID().toString());

            eventWriter.add(tab);
            eventWriter.add(eventFactory.createEndElement("", "", LOCALPEER));
            eventWriter.add(end);
            eventWriter.add(end);

            for (Collection<Host> levels : routingTable.getAllHostsByLevels()) {
                for (Host host : levels) {
                    StartElement hostStartElement = eventFactory.createStartElement("", "", HOST);
                    Attribute attribute = eventFactory.createAttribute(LEVEL, Integer.toString(levelIndex));
                    eventWriter.add(tab);
                    eventWriter.add(hostStartElement);
                    eventWriter.add(attribute);
                    eventWriter.add(end);

                    xmlPath = host.getHostPath().toString();
                    createNode(eventWriter, doubleTab, ADDRESS, host.getAddress().getHostName());
                    createNode(eventWriter, doubleTab, PORT, Integer.toString(host.getPort()));
                    createNode(eventWriter, doubleTab, PATH, (xmlPath.isEmpty() ? " " : xmlPath));
                    createNode(eventWriter, doubleTab, TIMESTAMP, Long.toString(host.getTimestamp()));
                    createNode(eventWriter, doubleTab, UUID_STR, host.getUUID().toString());

                    eventWriter.add(tab);
                    eventWriter.add(eventFactory.createEndElement("", "", HOST));
                    eventWriter.add(end);
                }
                eventWriter.add(end);
                levelIndex++;
            }

            eventWriter.add(eventFactory.createEndElement("", "", ROOT));
            eventWriter.add(end);
            eventWriter.add(eventFactory.createEndDocument());
            eventWriter.close();
        } catch (XMLStreamException e) {
            logger_.error("{}", e);
        } finally {
            IOUtilities.closeQuietly(outStream);
        }
    }