public JabbotStatisticsViewModel(JabbotViewModel jabbot, StatisticsViewModel statistics)
 {
     Jabbot = jabbot ?? JabbotViewModel.Default;
     Statistics = statistics ?? StatisticsViewModel.Default;
 }
        private StatisticsViewModel GetStatisticsViewModel()
        {
            var viewModel = StatisticsViewModel.Default;

            try
            {
                var allTimeHashFields = RedisConnection.Hashes.GetKeys(0, "Jabbot:Statistics:Sprockets:Usage:AllTime").Result;
                var allTimeHashValues = RedisConnection.Hashes.GetString(0, "Jabbot:Statistics:Sprockets:Usage:AllTime", allTimeHashFields).Result;
                var yearlyHashFields = RedisConnection.Hashes.GetKeys(0, string.Format("Jabbot:Statistics:Sprockets:Usage:{0:yyyy}", DateTimeOffset.UtcNow)).Result;
                var yearlyHashValues = yearlyHashFields.Length.Equals(0) ? new string[] { "0" } : RedisConnection.Hashes.GetString(0, string.Format("Jabbot:Statistics:Sprockets:Usage:{0:yyyy}", DateTimeOffset.UtcNow), yearlyHashFields).Result;
                var monthlyHashFields = RedisConnection.Hashes.GetKeys(0, string.Format("Jabbot:Statistics:Sprockets:Usage:{0:yyyyMM}", DateTimeOffset.UtcNow)).Result;
                var monthlyHashValues = monthlyHashFields.Length.Equals(0) ? new string[] { "0" } : RedisConnection.Hashes.GetString(0, string.Format("Jabbot:Statistics:Sprockets:Usage:{0:yyyyMM}", DateTimeOffset.UtcNow), monthlyHashFields).Result;
                var dailyHashFields = RedisConnection.Hashes.GetKeys(0, string.Format("Jabbot:Statistics:Sprockets:Usage:{0:yyyyMMdd}", DateTimeOffset.UtcNow)).Result;
                var dailyHashValues = dailyHashFields.Length.Equals(0) ? new string[] { "0" } : RedisConnection.Hashes.GetString(0, string.Format("Jabbot:Statistics:Sprockets:Usage:{0:yyyyMMdd}", DateTimeOffset.UtcNow), dailyHashFields).Result;

                var allTimeSum = (from hv in allTimeHashValues select Int64.Parse(hv)).Sum();
                var yearlySum = (from hv in yearlyHashValues select Int64.Parse(hv)).Sum();
                var monthlySum = (from hv in monthlyHashValues select Int64.Parse(hv)).Sum();
                var dailySum = (from hv in dailyHashValues select Int64.Parse(hv)).Sum();

                viewModel = new StatisticsViewModel(allTimeSum, dailySum, monthlySum);
            }
            catch (Exception ex)
            {
                Logger.ErrorException("An error occured while populating the StatisticsViewModel.", ex);
            }

            return viewModel;
        }