@Override
  public void init(final Element modelElement) {
    super.init(modelElement);

    adapt(RootXmlResource.class)
        .store()
        .registerModelElement(this.xmlElement.getDomNode(), modelElement);
  }
  @Override
  public void remove(final Resource resource) {
    final XmlResource xmlResource = (XmlResource) resource;
    final XmlElement xmlElement = xmlResource.getXmlElement();

    xmlElement.remove();

    if (this.path != null) {
      final XmlElement base = getBaseXmlElement(false);

      if (base != null) {
        final XmlElement parent = (XmlElement) base.getChildNode(this.path, false);

        if (parent != null && parent.isEmpty()) {
          base.removeChildNode(this.path);
        }
      }
    }
  }
 protected XmlElement getBaseXmlElement(final boolean createIfNecessary) {
   final XmlResource resource = (XmlResource) property().element().resource();
   return resource.getXmlElement(createIfNecessary);
 }