public Task Invoke()
        {
            IList <User> users = _userRepository.GetUsers();
            Int32        RECOMMENDED_CALLORIES_PER_DAY = 2000;
            Int32        MAX_WASTE_ALLOWED             = 200;

            foreach (var user in users)
            {
                IList <GroceryItem> itemsToExpire = _groceriesRepository.GetUserItemsExpiringInNearFuture(user.Id);
                Double idealCaloriesPerDay        = 0;

                foreach (var item in itemsToExpire)
                {
                    Double daysUntilExpired = (item.ExpirationDate - DateTime.Now).TotalDays;
                    idealCaloriesPerDay += item.Calories / daysUntilExpired;
                }

                Double waste = idealCaloriesPerDay - RECOMMENDED_CALLORIES_PER_DAY;
                if (waste > MAX_WASTE_ALLOWED)
                {
                    _SendNotification(user.Id, waste);
                }
            }

            return(Task.CompletedTask);
        }
        public void CheckExpirationDates()
        {
            IList <User> users = _userRepository.GetUsers();
            Int32        DAYS_BEFORE_EXPIRATION = 5;

            foreach (var user in users)
            {
                var itemsToExpire = _groceriesRepository.GetUserItemsExpiringInNearFuture(user.Id);

                foreach (var item in itemsToExpire)
                {
                    if (item.ExpirationDate.Date == DateTime.Now.AddDays(DAYS_BEFORE_EXPIRATION).Date)
                    {
                        Notify(user.Id, new Models.Groceries.GroceryItem(item));
                    }
                }
            }
        }