private Subscription fetchAndSave() {
   return client
       .getSessions(LocaleUtil.getCurrentLanguageId(getActivity()))
       .subscribeOn(Schedulers.io())
       .observeOn(AndroidSchedulers.mainThread())
       .subscribe(
           dao::updateAllAsync, throwable -> Log.e(TAG, "Failed to fetchAndSave.", throwable));
 }
 protected Subscription loadData() {
   Observable<List<Session>> cachedSessions = dao.findAll();
   return cachedSessions
       .flatMap(
           sessions -> {
             if (shouldRefresh || sessions.isEmpty()) {
               return client
                   .getSessions(LocaleUtil.getCurrentLanguageId(getActivity()))
                   .doOnNext(dao::updateAllAsync);
             } else {
               return Observable.just(sessions);
             }
           })
       .subscribeOn(Schedulers.io())
       .observeOn(AndroidSchedulers.mainThread())
       .subscribe(this::onLoadDataSuccess, this::onLoadDataFailure);
 }