private void addImage(ImageRef ref, String imageCsObjectName, BlobKey blobKey) {
    Optional<StoredReport> report = reportStore.tryLoadReport(ref.getOwnerId(), ref.getReportId());
    Preconditions.checkArgument(report.isPresent(), "Report not found: " + ref.toString());

    StoredImage image =
        StoredImage.builder()
            .setKey(StoredImage.toKey(ref))
            .setReport(Ref.create(report.get()))
            .setImageFileName(ref.getImageName())
            .setCloudStorageObjectName(imageCsObjectName)
            .setBlobKey(blobKey.getKeyString())
            .build();
    backend().save().entity(image).now();
  }
  private static BlobKey getBlobkKey(ImageRef ref) {
    ImageStore store = new ImageStore();
    store.init();

    Optional<StoredImage> image = store.tryLoadImage(ref);
    if (image.isPresent()) {
      log.info("Using blobkey: " + image.get().getBlobKey());
      return new BlobKey(image.get().getBlobKey());
    } else {
      GcsFilename oldGcsFileName = createOldGcsFileName(ref.getReportId(), ref.getImageName());
      log.info("Using old GCS fileName: " + oldGcsFileName.toString());

      BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
      // Does not work on dev server.
      return blobstoreService.createGsBlobKey(
          "/gs/" + oldGcsFileName.getBucketName() + "/" + oldGcsFileName.getObjectName());
    }
  }