treeRef = createTypeTree(parentTreePath, featureType);
metadataId = ObjectId.NULL;// treeRef.getMetadataId();
}
// ObjectId metadataId = treeRef.getMetadataId();
final Node node = putInDatabase(feature, metadataId);
RevTreeBuilder parentTree = context.command(FindOrCreateSubtree.class).setIndex(true)
.setParent(Suppliers.ofInstance(Optional.of(getTree())))
.setChildPath(parentTreePath).call().builder(indexDatabase);
parentTree.put(node);
final ObjectId treeMetadataId = treeRef.getMetadataId();
ObjectId newTree = context.command(WriteBack.class).setAncestor(getTreeSupplier())
.setChildPath(parentTreePath).setToIndex(true).setTree(parentTree.build())
.setMetadataId(treeMetadataId).call();
updateWorkHead(newTree);
final String featurePath = NodeRef.appendChild(parentTreePath, node.getName());
Optional<NodeRef> featureRef = context.command(FindTreeChild.class).setIndex(true)
.setParent(getTree()).setChildPath(featurePath).call();
return featureRef.get().getNode();
}