code: private boolean saveForest(Document doc,
                                 String revID,
                                 Map<String, Object> properties)
              throws ForestException {
          // after insertRevision, the selected revision is inserted revision.
          // need to select current revision.
          doc.selectCurrentRev();
          // Is the new revision the winner?
          boolean isWinner = doc.getSelectedRevID().equalsIgnoreCase(revID);
          // Update the documentType:
          if (!isWinner)
              properties = ForestBridge.bodyOfSelectedRevision(doc);
          if (properties != null && properties.containsKey("type") &&
                  properties.get("type") instanceof String)
              doc.setType((String) properties.get("type"));
          // save
          doc.save(maxRevTreeDepth);
          return isWinner;
      }
docs: /////////////////////////////////////////////////////////////////////////