public String insertNodeInto(
      DatasetConfigTreeNode editingNode, DatasetConfigTreeNode parentNode, int index) {
    int start, finish;
    Object child = editingNode.getUserObject();
    Object parent = parentNode.getUserObject();
    BaseNamedConfigurationObject parentObj = (BaseNamedConfigurationObject) parent;
    BaseNamedConfigurationObject childObj = (BaseNamedConfigurationObject) child;
    if (parentObj.getHidden() != null && parentObj.getHidden().equals("true")) {
      childObj.setHidden("true");
      Enumeration children = editingNode.breadthFirstEnumeration();
      DatasetConfigTreeNode childNode = null;
      while (children.hasMoreElements()) {
        childNode = (DatasetConfigTreeNode) children.nextElement();
        BaseNamedConfigurationObject ch = (BaseNamedConfigurationObject) childNode.getUserObject();
        ch.setHidden("true");
      }
    }

    String childClassName = (editingNode.getUserObject().getClass()).getName();
    start = childClassName.lastIndexOf(".") + 1;
    finish = childClassName.length();
    String childName = childClassName.substring(start, finish);

    // index is a Node index. objectIndex may be different
    int objIndex = index - DatasetConfigTreeNode.getHeterogenousOffset(parent, child);
    if (parent instanceof org.ensembl.mart.lib.config.DatasetConfig) {
      if (child instanceof org.ensembl.mart.lib.config.FilterPage) {
        config = (DatasetConfig) parentNode.getUserObject();
        config.insertFilterPage(objIndex, (FilterPage) editingNode.getUserObject());

      } else if (child instanceof org.ensembl.mart.lib.config.AttributePage) {
        config = (DatasetConfig) parentNode.getUserObject();
        config.insertAttributePage(objIndex, (AttributePage) editingNode.getUserObject());

      } else if (child instanceof org.ensembl.mart.lib.config.Importable) {
        config = (DatasetConfig) parentNode.getUserObject();
        config.insertImportable(objIndex, (Importable) editingNode.getUserObject());

      } else if (child instanceof org.ensembl.mart.lib.config.Exportable) {
        config = (DatasetConfig) parentNode.getUserObject();
        config.insertExportable(objIndex, (Exportable) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in a DatasetConfig.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.FilterPage) {
      if (child instanceof org.ensembl.mart.lib.config.FilterGroup) {
        FilterPage fp = (FilterPage) parentNode.getUserObject();
        fp.insertFilterGroup(objIndex, (FilterGroup) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in a FilterPage.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.FilterGroup) {
      if (child instanceof org.ensembl.mart.lib.config.FilterCollection) {
        FilterGroup fg = (FilterGroup) parentNode.getUserObject();
        fg.insertFilterCollection(objIndex, (FilterCollection) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in a FilterGroup.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.FilterCollection) {
      if (child instanceof org.ensembl.mart.lib.config.FilterDescription) {
        FilterCollection fc = (FilterCollection) parentNode.getUserObject();
        fc.insertFilterDescription(objIndex, (FilterDescription) editingNode.getUserObject());
      } else if (child instanceof org.ensembl.mart.lib.config.Option) {
        FilterCollection fc = (FilterCollection) parentNode.getUserObject();
        FilterDescription fdConvert = new FilterDescription((Option) editingNode.getUserObject());
        fc.insertFilterDescription(objIndex, fdConvert);
        editingNode.setUserObject(fdConvert);
      } else if (child instanceof org.ensembl.mart.lib.config.AttributeDescription) {
        FilterCollection fc = (FilterCollection) parentNode.getUserObject();
        // FilterDescription fdConvert = new FilterDescription((AttributeDescription)
        // editingNode.getUserObject());
        AttributeDescription ad = (AttributeDescription) editingNode.getUserObject();

        FilterDescription fdConvert = null;
        try {
          fdConvert =
              new FilterDescription(
                  ad.getInternalName(),
                  ad.getField(),
                  "text",
                  "=",
                  "=",
                  ad.getDisplayName(),
                  ad.getTableConstraint(),
                  ad.getKey(),
                  ad.getDescription(),
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "",
                  "");
        } catch (ConfigurationException e) {
          // guaranteed internal name for atts
        }
        fc.insertFilterDescription(objIndex, fdConvert);
        editingNode.setUserObject(fdConvert);
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in a FilterCollection.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.FilterDescription) {
      if (child instanceof org.ensembl.mart.lib.config.SpecificFilterContent) {
        FilterDescription ad = (FilterDescription) parentNode.getUserObject();
        ad.insertSpecificFilterContent(
            objIndex, (SpecificFilterContent) editingNode.getUserObject());
      } else if (child instanceof org.ensembl.mart.lib.config.FilterDescription) {
        FilterDescription fd = (FilterDescription) parentNode.getUserObject();
        Option opConvert = new Option((FilterDescription) editingNode.getUserObject());
        fd.insertOption(objIndex, opConvert);
        editingNode.setUserObject(opConvert);
      } else if (child instanceof org.ensembl.mart.lib.config.Option) {
        FilterDescription fd = (FilterDescription) parentNode.getUserObject();
        fd.insertOption(objIndex, (Option) editingNode.getUserObject());
      } else if (child instanceof org.ensembl.mart.lib.config.PushAction) {
        FilterDescription fd = (FilterDescription) parentNode.getUserObject();
        // fd.insertPushAction(objIndex, (PushAction) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in a FilterDescription.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.Option) {
      if (child instanceof org.ensembl.mart.lib.config.SpecificOptionContent) {
        Option ad = (Option) parentNode.getUserObject();
        ad.insertSpecificOptionContent(
            objIndex, (SpecificOptionContent) editingNode.getUserObject());
      } else if (child instanceof org.ensembl.mart.lib.config.PushAction) {
        Option op = (Option) parentNode.getUserObject();
        op.insertPushAction(objIndex, (PushAction) editingNode.getUserObject());
      } else if (child instanceof org.ensembl.mart.lib.config.Option) {
        Option op = (Option) parentNode.getUserObject();
        op.insertOption(objIndex, (Option) editingNode.getUserObject());
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.PushAction) {
      if (child instanceof org.ensembl.mart.lib.config.Option) {
        PushAction pa = (PushAction) parentNode.getUserObject();
        pa.insertOption(objIndex, (Option) editingNode.getUserObject());
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.AttributePage) {
      if (child instanceof org.ensembl.mart.lib.config.AttributeGroup) {
        AttributePage ap = (AttributePage) parentNode.getUserObject();
        ap.insertAttributeGroup(objIndex, (AttributeGroup) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in an AttributePage.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.AttributeGroup) {
      if (child instanceof org.ensembl.mart.lib.config.AttributeCollection) {
        AttributeGroup ag = (AttributeGroup) parentNode.getUserObject();
        ag.insertAttributeCollection(objIndex, (AttributeCollection) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in an AttributeGroup.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.AttributeCollection) {
      if (child instanceof org.ensembl.mart.lib.config.AttributeDescription) {
        AttributeCollection ac = (AttributeCollection) parentNode.getUserObject();
        ac.insertAttributeDescription(objIndex, (AttributeDescription) editingNode.getUserObject());
      } else if (child instanceof org.ensembl.mart.lib.config.AttributeList) {
        AttributeCollection ac = (AttributeCollection) parentNode.getUserObject();
        ac.insertAttributeList(objIndex, (AttributeList) editingNode.getUserObject());
      } else {
        String error_string =
            "Error: " + childName + " cannot be inserted in an AttributeCollection.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.AttributeDescription) {
      if (child instanceof org.ensembl.mart.lib.config.SpecificAttributeContent) {
        AttributeDescription ad = (AttributeDescription) parentNode.getUserObject();
        ad.insertSpecificAttributeContent(
            objIndex, (SpecificAttributeContent) editingNode.getUserObject());
      } else {
        String error_string = "Error: " + childName + " cannot be inserted in a FilterDescription.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.SpecificFilterContent) {
      if (child instanceof org.ensembl.mart.lib.config.Option) {
        SpecificFilterContent fd = (SpecificFilterContent) parentNode.getUserObject();
        System.out.println(
            "TREE MODEL 2 -- ADDING DYN OPTION "
                + ((Option) editingNode.getUserObject()).getInternalName());

        fd.insertOption(objIndex, (Option) editingNode.getUserObject());
      } else {
        String error_string =
            "Error: " + childName + " cannot be inserted in an DynamicFilterContent.";
        return error_string;
      }
    } else if (parent instanceof org.ensembl.mart.lib.config.SpecificAttributeContent) {
      String error_string =
          "Error: " + childName + " cannot be inserted in an DynamicAttributeContent.";
      return error_string;
    } else if (parent instanceof org.ensembl.mart.lib.config.SpecificOptionContent) {
      String error_string =
          "Error: " + childName + " cannot be inserted in an DynamicOptionContent.";
      return error_string;
    }
    super.insertNodeInto(editingNode, parentNode, index);
    return "success";
  }