public List <PlatformStatsToken> GetPlatformStats(ReportEnums.ePeriodSelectionKinds period)
        {
            var list = new List <PlatformStatsToken>();

            try
            {
                var reportPeriod = PeriodSelection2DateRange(period);

                var previousPeriod = Period2Previous(period);

                using (var context = new lfeAuthorEntities())
                {
                    var rows = context.tvf_FACT_DASH_GetPlatformStats(reportPeriod.from, reportPeriod.to).ToList();

                    var previousRows = context.tvf_FACT_DASH_GetPlatformStats(previousPeriod.from, previousPeriod.to).ToList();

                    var platformIds = rows.GroupBy(x => new { id = x.RegistrationTypeId }).Select(s => s.Key.id).ToArray();

                    foreach (var platformId in platformIds)
                    {
                        var platform        = Utils.ParseEnum <CommonEnums.eRegistrationSources>(platformId.ToString());
                        var subList         = rows.Where(x => x.RegistrationTypeId == (int)platform).OrderBy(x => x.FactDate).ToList();
                        var previousSubList = previousRows.Where(x => x.RegistrationTypeId == (int)platform).ToList();


                        var token = new PlatformStatsToken
                        {
                            Platform           = platform
                            , Index            = platform.RegistrationSource2AdminDashboardIndex()
                            , Stats            = new List <PlatformStatsBoxToken>()
                            , TotalPlatformNew = subList.Sum(x => x.TotalPlatformNew)
                        };

                        token.Tendency = token.TotalPlatformNew.Value2TendencyToken(previousSubList.Sum(x => x.TotalPlatformNew));

                        #region
                        Parallel.Invoke(
                            () =>
                        {
                            var box = new PlatformStatsBoxToken
                            {
                                Type     = ReportEnums.eStatsTypes.Authors
                                , Index  = 1
                                , Total  = subList[subList.Count - 1].TotalAuhtors
                                , New    = subList.Sum(x => x.NewAuthors)
                                , Points = new List <BaseChartPointToken>()
                            };

                            box.Tendency = box.New.Value2TendencyToken(previousSubList.Sum(x => x.NewAuthors));

                            foreach (var p in subList.OrderBy(x => x.FactDate).ToList())
                            {
                                box.Points.Add(new BaseChartPointToken
                                {
                                    date    = p.FactDate
                                    , value = p.NewAuthors
                                });
                            }

                            token.Stats.Add(box);
                        },
                            () =>
                        {
                            var box = new PlatformStatsBoxToken
                            {
                                Type     = ReportEnums.eStatsTypes.Items
                                , Index  = 2
                                , Total  = subList[subList.Count - 1].TotalItems
                                , New    = subList.Sum(x => x.NewItems)
                                , Points = new List <BaseChartPointToken>()
                            };

                            box.Tendency = box.New.Value2TendencyToken(previousSubList.Sum(x => x.NewItems));

                            foreach (var p in subList.OrderBy(x => x.FactDate).ToList())
                            {
                                box.Points.Add(new BaseChartPointToken
                                {
                                    date    = p.FactDate
                                    , value = p.NewItems
                                });
                            }

                            token.Stats.Add(box);
                        },
                            () =>
                        {
                            var box = new PlatformStatsBoxToken
                            {
                                Type     = ReportEnums.eStatsTypes.Stores
                                , Index  = 3
                                , Total  = subList[subList.Count - 1].TotalStores
                                , New    = subList.Sum(x => x.NewStores)
                                , Points = new List <BaseChartPointToken>()
                            };

                            box.Tendency = box.New.Value2TendencyToken(previousSubList.Sum(x => x.NewStores));

                            foreach (var p in subList.OrderBy(x => x.FactDate).ToList())
                            {
                                box.Points.Add(new BaseChartPointToken
                                {
                                    date    = p.FactDate
                                    , value = p.NewStores
                                });
                            }

                            token.Stats.Add(box);
                        },
                            () =>
                        {
                            var box = new PlatformStatsBoxToken
                            {
                                Type     = ReportEnums.eStatsTypes.Learners
                                , Index  = 4
                                , Total  = subList[subList.Count - 1].TotalLearners
                                , New    = subList.Sum(x => x.NewLearners)
                                , Points = new List <BaseChartPointToken>()
                            };

                            box.Tendency = box.New.Value2TendencyToken(previousSubList.Sum(x => x.NewLearners));

                            foreach (var p in subList.OrderBy(x => x.FactDate).ToList())
                            {
                                box.Points.Add(new BaseChartPointToken
                                {
                                    date    = p.FactDate
                                    , value = p.NewLearners
                                });
                            }

                            token.Stats.Add(box);
                        },
                            () =>
                        {
                            var box = new PlatformStatsBoxToken
                            {
                                Type     = ReportEnums.eStatsTypes.Sales
                                , Index  = 5
                                , Total  = subList[subList.Count - 1].TotalSales
                                , New    = subList.Sum(x => x.NewSales)
                                , Points = new List <BaseChartPointToken>()
                            };

                            box.Tendency = box.New.Value2TendencyToken(previousSubList.Sum(x => x.NewSales));

                            foreach (var p in subList.OrderBy(x => x.FactDate).ToList())
                            {
                                box.Points.Add(new BaseChartPointToken
                                {
                                    date    = p.FactDate
                                    , value = p.NewSales
                                });
                            }

                            token.Stats.Add(box);
                        });
                        #endregion

                        list.Add(token);
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                Logger.Error("Get platform stats for admin dashboard", ex, CommonEnums.LoggerObjectTypes.Reports);
                return(list);
            }
        }