private async void GetTodaysStats(IEnumerable<Transaction> transactions, DashboardViewModel dashboardVM)
        {
            var today = DateTime.Now;
            var todaysTransactions = from t in transactions
                                     where t.Date > today.Date
                                     select t;

            var userGrouping = todaysTransactions.GroupBy(t => t.UserID);
            int newUserCount = 0;
            foreach (var u in userGrouping) 
            {
                var userHistory = await this.userStore.GetUserHistory(u.Key);
                var matchingTransactions = userHistory.Where(t => t.BusinessID == businessId);
                if (matchingTransactions == null || matchingTransactions.Count() == 0) { newUserCount++; }
            }

            dashboardVM.todaysNewUsers = newUserCount;
            dashboardVM.todaysStamps = todaysTransactions.Where(t => t.Type == TransactionType.Stamp).Count();
        }
        // GET: Dashboard
        public async Task<ActionResult> Dashboard_v1()
        {
            var dashboardVM = new DashboardViewModel();
            if(string.IsNullOrEmpty(businessId))
            {
                businessId = (string)System.Web.HttpContext.Current.Session["id"];
            }
            dashboardVM.BusinessId = businessId;
            var transactions = await this.transactionStore.GetTransactionByBusinessId(businessId);

            // Top 3 widget data
            dashboardVM.totalUniqueUsers = transactions.GroupBy(t => t.UserID).Count();
            GetTodaysStats(transactions, dashboardVM);
            
            // tabbed table data
            dashboardVM.topUsersThisWeek = await GetTopXUsersThisWeek(transactions, rowsForTabbedTable);
            dashboardVM.todaysTransactions = await GetTodaysRecentXTransactions(transactions, rowsForTabbedTable); 

            return View(dashboardVM);
        }
        /// Deprecated
        private void GetTopActiveUser(IEnumerable<Transaction> transactions, DashboardViewModel dashboardVM)
        {
            var today = DateTime.UtcNow;
            var todaysTransactions = from t in transactions
                                     where t.Date > today.AddDays(-7)
                                     select t;

            var a = todaysTransactions.GroupBy(t => t.UserID);
            var b = a.Select(group => new { userid = group.Key, count = group.Count() });

            var userStatList = todaysTransactions.GroupBy(t => t.UserID).Select(group => new
            {
                userid = group.Key,
                stampCount = group.GroupBy(t => t.Type == TransactionType.Stamp).Count(),
                rewardCount = group.GroupBy(t => t.Type == TransactionType.RedeemReward).Count(),
            });

            var c = b.OrderByDescending(u => u.count);
            var d = c.FirstOrDefault();

            var userCounts = todaysTransactions.GroupBy(t => t.UserID).
                Select(group => new { userid = group.Key, count = group.Count() }).OrderBy(u => u.count).Take(10);
        }