code: protected static Object getIdForEntity(Object document, Method getterMethodForId) {
      Object id = null;
      if (null != getterMethodForId) {
        try {
          id = getterMethodForId.invoke(document);
        } catch (IllegalAccessException e) {
          logger.error("Failed to invoke getter method for a idAnnotated field due to permissions", e);
          throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field due to permissions", e);
        } catch (IllegalArgumentException e) {
          logger.error("Failed to invoke getter method for a idAnnotated field due to wrong arguments", e);
          throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field due to wrong arguments", e);
        } catch (InvocationTargetException e) {
          logger.error("Failed to invoke getter method for a idAnnotated field, the method threw a exception", e);
          throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field, the method threw a exception", e);
        }
      }
      return id;
    }
docs: A utility method to extract the value of field marked by the @Id annotation using its
  getter/accessor method.
  @param document the actual Object representing the POJO we want the Id of.
  @param getterMethodForId the Method that is the accessor for the attributed with @Id annotation
  @return the actual Id or if none exists then a new random UUID