code: public UNode toGroupedDoc(TableDefinition tableDef) {
          Utils.require(tableDef != null, "tableDef");
          UNode resultNode = UNode.createMapNode("doc");
          
          Set<FieldDefinition> deferredFields = new HashSet<FieldDefinition>();
          for (String fieldName : getUpdatedFieldNames()) {
              FieldDefinition fieldDef = tableDef.getFieldDef(fieldName);
              if (fieldDef != null && fieldDef.isNestedField()) {
                  FieldDefinition groupFieldDef = fieldDef.getParentField();
                  while (groupFieldDef != null && !deferredFields.contains(groupFieldDef)) {
                      deferredFields.add(groupFieldDef);
                      groupFieldDef = groupFieldDef.getParentField();
                  }
                  deferredFields.add(fieldDef);
              } else {
                  leafFieldtoDoc(resultNode, fieldName);
              }
          }
          
          for (FieldDefinition fieldDef : deferredFields) {
              if (!fieldDef.isNestedField()) {
                  groupFieldtoDoc(resultNode, fieldDef, deferredFields);
              }
          }
          return resultNode;
      }
docs: Serialize this DBObject into a {@link UNode} tree, showing nested fields within
  their parent group fields. The root node of the UNode tree is returned. The tree
  returned can then be turned into JSON or XML by calling {@link UNode#toJSON()} or
  {@link UNode#toXML()}. This method uses the given {@link TableDefinition} to
  understand the table's group field structure. For example, a UNode tree converted
  to JSON might look like:
  <pre>
  {"doc": {
  "_ID": "28cn2812ur",
  "_table": "Message",
  "Content": {
  "Subject": "Concrete slabs",
  },
  "Tags": {
  "add": ["Confidential", "Priority"]   // MV values are sorted
  },
  "Sender": ["1dj2r4j1l"]
  }}
  </pre>
  
  @param  tableDef TableDefinition that defines group and nested field names, which
  are used to create the nested UNode structure.
  @return          The root node of a UNode tree.