@Override
  protected CollageRegionData performLoad() throws Exception {
    final File filesDir = CommonUtils.getCacheFileDir();
    if (null == filesDir) {
      throw new DiskWriteException();
    }
    final File outputFile = new File(filesDir, String.format(IMAGE_NAME, mCollageRegion.getId()));
    if (outputFile.exists() && !outputFile.delete()) {
      throw new DiskWriteException();
    }

    final HttpURLConnection connection =
        (HttpURLConnection) new URL(mPost.getStandardResolutionImage().getUrl()).openConnection();

    connection.setUseCaches(true);
    final int responseCode = connection.getResponseCode();
    if (responseCode >= 300) {
      connection.disconnect();
      throw new InternalServerException();
    }

    CommonUtils.writeNetworkStreamToAnOtherStream(
        connection.getInputStream(), new FileOutputStream(outputFile));
    connection.disconnect();

    if (outputFile.exists()) {
      return new CollageRegionData(outputFile);
    } else {
      throw new DiskWriteException();
    }
  }
 @Override
 public boolean onOptionsItemSelected(final MenuItem item) {
   if (item.getItemId() == R.id.menu_share_collage) {
     if (null != mResultPath) {
       // because we use internal storage and provider, we should grand other apps permissions and
       // so on...
       CommonUtils.sendEmailWithAttachment(
           getActivity(), mResultPath, getString(R.string.text_email_subject));
     }
     return true;
   }
   return super.onOptionsItemSelected(item);
 }