private static PhotoModel convertToPhotoModel(
      GoogleMediaItem mediaItem,
      Optional<String> albumId,
      TempMediaData tempMediaData) throws InvalidExportedItemException, ParseException {
    boolean shouldUpload = albumId.isPresent();
    if (tempMediaData != null) {
      shouldUpload = shouldUpload || !tempMediaData.isContainedPhotoId(mediaItem.getId());
    }

    if (!shouldUpload)
      throw new InvalidExportedItemException(
          String.format("Failed to convert media item (id: %s) into a PhotoModel", mediaItem.getId())
      );

    try {
      return GoogleMediaItem.convertToPhotoModel(albumId, mediaItem);
    } catch (IllegalArgumentException | ParseException e) {
      throw new InvalidExportedItemException(
          String.format("Failed to convert media item (id: %s) into a PhotoModel : %s", mediaItem.getId(), e)
      );
    }
  }
Method for storing a list of all photos that are already contained in albums
extensions/data-transfer/portability-data-transfer-google/src/main/java/org/datatransferproject/datatransfer/google/photos/GooglePhotosExporter.java