public async Task <IActionResult> Transactions(
            TransactionsVm transactionsVm,
            int pageNumber = 1)
        {
            var value = RouteData.Values["id"];

            if (value == null)
            {
                return(RedirectToAction("Index", "MyAccounts"));
            }

            Guid.TryParse(value.ToString(), out var id);

            if (!ModelState.IsValid)
            {
                return(View(transactionsVm));
            }

            string lowellReference = ApplicationSessionState.GetLowellReferenceFromSurrogate(id);

            if (string.IsNullOrEmpty(lowellReference))
            {
                throw new Exception("No lowell reference found in cache");
            }

            Account account = ApplicationSessionState.GetAccount(lowellReference);

            if (account == null)
            {
                account = await _accountsService.GetAccount(LoggedInUserId, lowellReference);

                ApplicationSessionState.SaveAccount(account, lowellReference);
            }

            List <Transaction> transactions = ApplicationSessionState.GetTransactions(lowellReference);

            if (transactions == null)
            {
                transactions = await _transactionsService.GetTransactions(account.AccountReference);

                ApplicationSessionState.SaveTransactions(transactions, lowellReference);
            }

            if (transactions == null)
            {
                transactions = new List <Transaction>();
            }

            transactionsVm.AccountName      = account.OriginalCompany;
            transactionsVm.AccountBalance   = account.OutstandingBalance;
            transactionsVm.AccountReference = account.AccountReference;

            _gtmService.RaiseTransactionsViewedEvent(transactionsVm, LoggedInUserId, "Regular Account");
            await _webActivityService.LogAllTransactionsViewed(transactionsVm.AccountReference, LoggedInUserId);

            if (transactionsVm.FilterTransactions.DateFrom != null)
            {
                transactions = transactions.Where(x => x.Date >= transactionsVm.FilterTransactions.DateFrom).ToList();
            }

            if (transactionsVm.FilterTransactions.DateTo != null)
            {
                transactions = transactions.Where(x => x.Date <= transactionsVm.FilterTransactions.DateTo).ToList();
            }

            if (!string.IsNullOrEmpty(transactionsVm.FilterTransactions.KeyWord))
            {
                transactions = transactions.Where(x => x.Description.ToLower().Contains(transactionsVm.FilterTransactions.KeyWord.ToLower())).ToList();
            }

            transactions = transactions.OrderByDescending(x => x.Date).ToList();

            if (!transactions.Any())
            {
                transactionsVm.FilterTransactions.DateMessage = "No Results Found";
            }

            transactionsVm.PagedList =
                _mapper.Map <List <Transaction>, List <TransactionVm> >(transactions).ToPagedList(pageNumber, _pageSize);

            transactionsVm.LoggedInUserID    = LoggedInUserId;
            transactionsVm.LoggedInLowellRef = ApplicationSessionState.GetLoggedInLowellRef();

            return(View(transactionsVm));
        }