private Subscription subscribeHistorySave(Observable<TranslateResult> resultObservable) {
   return resultObservable
       .debounce(1000, TimeUnit.MILLISECONDS)
       .map(
           result ->
               new HistoryItem(
                   mOriginalTextInput.getText().toString(), result.getText(), result.getLang()))
       .filter(item -> item.getOriginal().length() > 0 && item.getTranslate().length() > 0)
       .subscribe(
           historyItem -> {
             History.putObject(ActivityTranslator.this, historyItem);
           });
 }
  @Override
  protected void onStart() {
    super.onStart();

    Uri filePath = getFilePath();

    Observable<UploadStatus> uploadStatusObservable =
        UploadStatusObservables.getObservable(filePath);
    if (uploadStatusObservable == null) {
      // Upload have finished.
      onUploadSuccess();
    } else {
      uploadStatusObservable
          // Upload progress events come in big chunks, throttle them a little.
          .debounce(50, TimeUnit.MILLISECONDS)
          .observeOn(AndroidSchedulers.mainThread())
          .subscribe(statusObserver);
    }
  }