/**
   * Stores a photo on S3 and then updates the underlying Photo object with the URL's that point to
   * the image locations on S3.
   *
   * <p>The scaling process creates three separate images, a web size, a thumbnail, and then the
   * untouched original upload. The original is stored using full S3 redundancy, but the thumbnail
   * and web size versions are stored using reduced redundancy. In the event of a loss of reduced
   * redundancy data, the thumbnail and websize data could be regenerated if need be but that's not
   * implemented here.
   *
   * @param photo the photo data to be stored (should be initialized with a photo ID before being
   *     passed in)
   * @param photoData raw data for the photo itself
   * @throws IOException
   */
  public static Photo storePhoto(Photo photo, byte[] photoData) throws IOException {

    // Store various photo sizes
    String thumbnailPath = storeThumbnail(photo, photoData);
    photo.setThumbnailPath(thumbnailPath);

    String websizePath = storeWebsize(photo, photoData);
    photo.setWebsizePath(websizePath);

    String originalPath = storeOriginal(photo, photoData);
    photo.setOriginalPath(originalPath);

    return photo;
  }