private static void writeExternal(Element element, @Nullable CachedTreePresentationData data) {
    if (data == null) return;
    Element root = XmlSerializer.serialize(new SerializableCachedPresentation(data));
    for (CachedTreePresentationData child : data.getChildren()) {
      writeExternal(root, child);
    }
    element.addContent(root);
  }
private static void writeExternal(Element element, @Nullable CachedTreePresentationData data)