private void rescheduleAlarm(List<ItemGridModel> agenda) {

    for (ItemGridModel item : agenda) {
      Utils.removeAlarm(getActivity(), item);
      Utils.setAlarm(getActivity(), item);

      try {
        List<ItemGridModel> items = mDatabaseHelper.getItemGridByProposta(item.getPid());
        for (ItemGridModel itemGridModel : items) {
          itemGridModel.setAssistir(Boolean.TRUE);
          mDatabaseHelper.getItemGridDao().update(itemGridModel);
        }
      } catch (Exception e) {

      }
    }
  }
  private void criarItemGradeFakePassado(int minutos) {

    String titulo = "Evento de Teste Passado - ";

    // Teste de AlarmManager
    Calendar inicio = Calendar.getInstance();
    inicio.set(Calendar.DAY_OF_MONTH, inicio.get(Calendar.DAY_OF_MONTH) - 1);
    inicio.set(Calendar.HOUR_OF_DAY, 9);
    inicio.set(Calendar.MINUTE, 5 + minutos);
    inicio.set(Calendar.SECOND, 0);

    Calendar fim = Calendar.getInstance();
    fim.setTimeInMillis(inicio.getTimeInMillis());
    fim.add(Calendar.HOUR_OF_DAY, 1);

    ItemGridModel itemGrade = new ItemGridModel();
    itemGrade.setInicio(new Date(inicio.getTimeInMillis()));
    itemGrade.setFim(new Date(fim.getTimeInMillis()));
    // itemGrade.setIsAssistir(true);
    itemGrade.setPid(140);
    itemGrade.setTime(1);
    itemGrade.setDate(1);
    itemGrade.setPlace(1);
    itemGrade.setTitle(titulo + minutos);
    itemGrade.setType(1);

    AuthorModel author = new AuthorModel();
    author.setCurriculum("Biografia");
    author.setId(900);
    author.setName("Clovis Lemes Ferreira Junior");

    itemGrade.setAuthor(author);

    List<ItemGridModel> t = mDatabaseHelper.getItemGridDao().queryForEq("title", titulo + minutos);

    if (t == null || t.isEmpty()) {
      mDatabaseHelper.createItemGrid(itemGrade);
    }
  }
    @Override
    protected void onPostExecute(ItemGridModel[] result) {

      if (result != null && result.length > 0) {

        List<ItemGridModel> items = Arrays.asList(result);

        List<ItemGridModel> agenda = mDatabaseHelper.getAgenda();

        mDatabaseHelper.removeAllItemGrid();

        for (ItemGridModel item : items) {
          item.setAuthor(
              new AuthorModel(item.getAuthorId(), item.getAuthorName(), item.getCurriculum()));
          item.setInicio(Utils.getTime(item.getDate(), item.getTime(), true));
          item.setFim(Utils.getTime(item.getDate(), item.getTime(), false));
          mDatabaseHelper.createItemGrid(item);
        }

        rescheduleAlarm(agenda);
      } else {
        Toast.makeText(mContext, getString(R.string.server_down), Toast.LENGTH_LONG).show();
      }

      if (mProgressDialog.isShowing()) {
        mProgressDialog.dismiss();
      }

      createViewPager();
    }