public Document saveToDocument() throws WriteExternalException {
   if (isLocal()) {
     Element root = new Element(ROOT_ELEMENT_TAG);
     root.setAttribute(PROFILE_NAME_TAG, myName);
     writeExternal(root);
     // myVisibleTreeState.writeExternal(root);
     return new Document(root);
   } else {
     return null;
   }
 }