@Override
  public <T extends DataModel> void create(UUID jobId, String key, T model) throws IOException {
    Preconditions.checkNotNull(jobId);
    Transaction transaction = datastore.newTransaction();
    Key fullKey = getDataKey(jobId, key);
    Entity shouldNotExist = transaction.get(fullKey);
    if (shouldNotExist != null) {
      transaction.rollback();
      throw new IOException(
          "Record already exists for key: " + fullKey.getName() + ". Record: " + shouldNotExist);
    }

    String serialized = objectMapper.writeValueAsString(model);
    Entity entity =
        Entity.newBuilder(fullKey)
            .set(CREATED_FIELD, Timestamp.now())
            .set(model.getClass().getName(), serialized)
            .build();

    try {
      transaction.put(entity);
    } catch (DatastoreException e) {
      throw new IOException(
          "Could not create initial record for jobID: " + jobId + ". Record: " + entity, e);
    }
    transaction.commit();
  }
Finds the ID of the first {@link PortabilityJob} in state {@code jobState} in Datastore, or
null if none found.

<p>TODO(rtannenbaum): Order by creation time so we can process jobs in a FIFO manner. Trying to
OrderBy.asc("created") currently fails because we don't yet have an index set up.
extensions/cloud/portability-cloud-google/src/main/java/org/datatransferproject/cloud/google/GoogleJobStore.java