Add writeTree method to objectstore.