@Override
  public <T extends DataModel> void update(UUID jobId, String key, T model) {
    Transaction transaction = datastore.newTransaction();
    Key entityKey = getDataKey(jobId, key);

    try {
      Entity previousEntity = transaction.get(entityKey);
      if (previousEntity == null) {
        throw new IOException("Could not find record for data key: " + entityKey.getName());
      }

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

      transaction.put(entity);
      transaction.commit();
    } catch (IOException t) {
      transaction.rollback();
      throw new RuntimeException("Failed atomic update of key: " + key, t);
    }
  }
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