docs: @Override
      public void createOrUpdateDocument(final Path path, final Serioulizer.Stream stream) throws IOException {
  
          sessionExistsPreCondition(); // throws illegalStateException if no session
  
          log.debug("createOrUpdateDocument | path: {}, length: {}, mimetype: {}, stream: {}", path, stream.getLength(), stream.getMimeType(), stream.getInputStream());
  
          // get root folder from CMIS session
          Folder rootFolder = this.openCMISSession.getRootFolder();
          if (rootFolder == null) {
              throw new IOException("No root folder ?!");
          }
  
          // get the penultimate element of the path as Folder, create if not exists.
          int    nameCount = path.getNameCount();
          Folder folder    = rootFolder;
          for (int i = 0; i < nameCount-1; i++) {
              folder = getOrCreateFolder(folder, path.getName(i).toString());
          }
          // get the ultimate element of the path as filename
          String fileName = path.getFileName().toString();
  
          // prepare the content to be written
          ContentStream contentStream = this.openCMISSession.getObjectFactory().createContentStream(
                  fileName,
                  stream.getLength(),
                  stream.getMimeType(),
                  stream.getInputStream());
  
          // search for the document, update it when found, and we're done.
          ItemIterable<CmisObject> children = folder.getChildren();
          if (children.iterator().hasNext()) {
              for (CmisObject o : children) {
                  if (o instanceof Document && o.getName().equals(fileName)) {
                      ((Document)o).setContentStream(contentStream, true);
                      log.info("Document at path '{}' found and updated!", path.toString());
                      return;
                  }
              }
          }
          // at this point, document does not exist
  
          // create new document (requires at least type id, name of the document and some content)
          Map<String, Object> properties = new HashMap<String, Object>();
          properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
          properties.put(PropertyIds.NAME, fileName);
          folder.createDocument(properties, contentStream, VersioningState.NONE);
          log.info("Document at path '{}' created!", path.toString());
      }