public async Task<ActionResult> ListEmailMessages()
        {
            var appState = Session["ClientCredsAddinAppState"] as AppState;

            // get requested mailbox
            var requestedMailbox = Request.Form["Mailbox"];

            // build view model
            var viewModel = new MailViewModel
            {
                AppState = appState,
                SelectedMailbox = requestedMailbox,
                UserListSelectors = GetMailboxSelectOptions(appState.MailboxList)
            };

            // get messages
            var repo = new MessageRepository(viewModel.AppState.AppOnlyGraphToken);
            var mailBox = appState.MailboxList.Where(pair => pair.Value == requestedMailbox).FirstOrDefault();
            var results = await repo.GetMessages(mailBox.Key);

            viewModel.SelectedMailbox = requestedMailbox;
            viewModel.Messages = results;

            return View("Index", viewModel);
        }
    public async Task<ActionResult> ListEmailMessages() {
      var appState = Session["ClientCredsAddinAppState"] as AppState;

      // get requested mailbox
      var requestedMailbox = Request.Form["Mailbox"];

      // build view model
      var viewModel = new MailViewModel {
        AppState = appState,
        SelectedMailbox = requestedMailbox,
        UserListSelectors = GetMailboxSelectOptions(appState.MailboxList)
      };

      // get messages
      var repo = new MessageRepository(viewModel.AppState.ExchangeOnlineAccessToken);
      var results = await repo.GetMessages(requestedMailbox);

      viewModel.SelectedMailbox = requestedMailbox;
      viewModel.Messages = results;

      return View("Index", viewModel);
    }