code: private Object convertParameter(Object value) {
          if (entityInstanceManager.isInstance(value)) {
              return entityInstanceManager.getDatastoreType(value);
          } else if (relationInstanceManager.isInstance(value)) {
              return relationInstanceManager.getDatastoreType(value);
          } else if (value instanceof Collection) {
              Collection collection = (Collection) value;
              List<Object> values = new ArrayList<>();
              for (Object o : collection) {
                  values.add(convertParameter(o));
              }
              return values;
          }
          return value;
      }
docs: Converts the given parameter value to instances which can be passed to the
  datastore.
  
  @param value
  The value.
  @return The converted value.