code: public String getOrGenerateDocumentId(Object entity) {
          Reference<String> idHolder = new Reference<>();
          tryGetIdFromInstance(entity, idHolder);
          String id = idHolder.value;
          if (id == null) {
              // Generate the key up front
              id = _generateId.apply(entity);
          }
  
          if (id != null && id.startsWith("/")) {
              throw new IllegalStateException("Cannot use value '" + id + "' as a document id because it begins with a '/'");
          }
          return id;
      }
docs: Tries to get the identity.
  @param entity Entity
  @return Document id