@Override
 public void insertDef(int beforeIndex, Wom3DefinitionListDef def)
     throws IndexOutOfBoundsException {
   Backbone parent = getParentNode();
   if (parent != null) {
     int size = defs.size();
     if (beforeIndex < 0 || beforeIndex > size) throw new IndexOutOfBoundsException();
     if (beforeIndex == size) {
       // Is expected to assertWritable();
       appendDef(def);
     } else {
       // Is expected to assertWritable();
       parent.insertBefore(def, defs.get(beforeIndex));
     }
   } else {
     assertWritableOnDocument();
     defs.add(beforeIndex, def);
   }
 }
  @Override
  public void appendDef(Wom3DefinitionListDef def) {
    Backbone parent = getParentNode();
    if (parent != null) {
      Wom3Node before = null;
      if (!defs.isEmpty()) {
        Wom3DefinitionListDef lastDef = defs.get(defs.size() - 1);
        before = lastDef.getNextSibling();
      } else {
        before = this.getNextSibling();
      }

      if (before == null) {
        // Is expected to assertWritable();
        parent.appendChild(def);
      } else {
        // Is expected to assertWritable();
        parent.insertBefore(def, before);
      }
    } else {
      assertWritableOnDocument();
      defs.add(def);
    }
  }