@Override
  public void onStop() {

    if (emptyPresenter != null) {
      emptyPresenter.stop();
    }
    if (emptyPresenter2 != null) {
      emptyPresenter2.stop();
    }
    // stop show more
    if (showMorePresenter != null) {
      showMorePresenter.stop();
    }
    if (showMorePresenter2 != null) {
      showMorePresenter2.stop();
    }

    // stop presenters
    unbindPresenters(0);
  }
  /**
   * Unbinds all the presenters
   *
   * @param target : which presenters all unbinded, 0=all, 1=mymeals, 2=most popular, 3=search
   *     results
   */
  private void unbindPresenters(int target) {

    // my meals
    if (myMealPresenters != null && (target == 0 || target == 1)) {

      if (emptyPresenter != null) {
        emptyPresenter.stop();
      }
      if (showMorePresenter != null) {
        showMorePresenter.stop();
      }

      for (int i = 0; i < myMealPresenters.size(); i++) {
        final Presenter presenter = myMealPresenters.get(i);
        if (presenter != null) {
          presenter.stop();
        }
      }
      myMealPresenters.clear();
    }

    // most popular
    if (mostPopularPresenters != null && (target == 0 || target == 2)) {

      if (emptyPresenter2 != null) {
        emptyPresenter2.stop();
      }
      if (showMorePresenter2 != null) {
        showMorePresenter2.stop();
      }

      for (int i = 0; i < mostPopularPresenters.size(); i++) {
        final Presenter presenter = mostPopularPresenters.get(i);
        if (presenter != null) {
          presenter.stop();
        }
      }
      mostPopularPresenters.clear();
    }
  }
  /** Loads meals */
  void loadMyMeals(final int index) {

    if (emptyPresenter != null) {
      emptyPresenter.stop();
    }
    // stop show more
    if (showMorePresenter != null) {
      showMorePresenter.stop();
    }
    // stop presenters if first items
    if (index == 0) {
      unbindPresenters(1);
    }

    // add empty presenter
    emptyPresenter =
        new EmptyPresenter(
            rpcService,
            eventBus,
            (EmptyDisplay) GWT.create(EmptyView.class),
            EmptyPresenter.EMPTY_LOADING);
    emptyPresenter.run(display.getMyMealsContainer());

    // get meals
    Motiver.setNextCallCacheable(true);
    final Request req =
        rpcService.getMeals(
            index,
            new MyAsyncCallback<List<MealModel>>() {
              @Override
              public void onSuccess(List<MealModel> result) {
                showMyMeals(index, result);
              }
            });
    addRequest(req);
  }
  /**
   * Shows user's meals
   *
   * @param list : MealModels
   */
  private void showMyMeals(final int index, List<MealModel> list) {

    try {

      if (emptyPresenter != null) {
        emptyPresenter.stop();
      }
      // stop show more
      if (showMorePresenter != null) {
        showMorePresenter.stop();
      }
      // stop presenters if first items
      if (index == 0) {
        unbindPresenters(1);
      }

      // if no meals
      if (index == 0 && list.size() == 0) {
        emptyPresenter =
            new EmptyPresenter(
                rpcService,
                eventBus,
                (EmptyDisplay) GWT.create(EmptyView.class),
                AppController.Lang.NoMeals());
        emptyPresenter.run(display.getMyMealsContainer());
      } else {

        for (final MealModel m : list) {

          // if null value -> list was limited -> add showMorePresenter
          if (m == null) {
            showMorePresenter =
                new ShowMorePresenter(
                    rpcService,
                    eventBus,
                    (ShowMoreDisplay) GWT.create(ShowMoreView.class),
                    new ShowMoreHandler() {
                      @Override
                      public void showMore() {
                        loadMyMeals(index + Constants.LIMIT_MEALS);
                      }
                    });
            showMorePresenter.run(display.getMyMealsContainer());
          } else {
            // new presenter
            final MealLinkPresenter wp =
                new MealLinkPresenter(
                    rpcService,
                    eventBus,
                    (MealLinkDisplay) GWT.create(MealLinkView.class),
                    m,
                    quickSelectionEnabled);
            addNewMyMealPresenter(wp);
          }
        }
      }

    } catch (Exception e) {
      Motiver.showException(e);
    }
  }