private boolean tryToClaimJob(UUID jobId, WorkerKeyPair keyPair) {
    // Lookup the job so we can append to its existing properties.
    PortabilityJob existingJob = store.findJob(jobId);
    monitor.debug(() -> format("JobPollingService: tryToClaimJob: jobId: %s", existingJob));

    // TODO: Consider moving this check earlier in the flow
    String scheme = existingJob.jobAuthorization().encryptionScheme();
    if (publicKeySerializer == null) {
      monitor.severe(
          () ->
              format(
                  "Public key serializer not found for scheme %s processing job: %s",
                  scheme, jobId));
      return false;
    }
    String serializedKey = publicKeySerializer.serialize(keyPair.getEncodedPublicKey());

    PortabilityJob updatedJob =
        existingJob
            .toBuilder()
            .setAndValidateJobAuthorization(
                existingJob
                    .jobAuthorization()
                    .toBuilder()
                    .setInstanceId(keyPair.getInstanceId())
                    .setAuthPublicKey(serializedKey)
                    .setState(JobAuthorization.State.CREDS_ENCRYPTION_KEY_GENERATED)
                    .build())
            .build();
    // Attempt to 'claim' this job by validating it is still in state CREDS_AVAILABLE as we
    // update it to state CREDS_ENCRYPTION_KEY_GENERATED, along with our key. If another transfer
    // instance polled the same job, and already claimed it, it will have updated the job's state
    // to CREDS_ENCRYPTION_KEY_GENERATED.
    try {
      store.claimJob(
          jobId,
          updatedJob);

      monitor.debug(() -> format("Stored updated job: tryToClaimJob: jobId: %s", existingJob));
    } catch (IllegalStateException | IOException e) {
      monitor.debug(
          () ->
              format(
                  "Could not claim job %s. It was probably already claimed by another transfer"
                      + " worker. Error msg: %s",
                  jobId, e.getMessage()),
          e);

      return false;
    }

    if (monitor instanceof JobAwareMonitor) {
      ((JobAwareMonitor) monitor).setJobId(jobId.toString());
    }

    JobMetadata.init(
        jobId,
        keyPair.getEncodedPrivateKey(),
        existingJob.transferDataType(),
        existingJob.exportService(),
        existingJob.importService(),
        Stopwatch.createUnstarted());
    monitor.debug(
        () -> format("Stored updated job: tryToClaimJob: JobMetadata initialized: %s", jobId));

    return true;
  }
Claims {@link PortabilityJob} {@code jobId} and updates it with our public key in storage.
Returns true if the claim was successful; otherwise it returns false.
portability-transfer/src/main/java/org/datatransferproject/transfer/JobPollingService.java