public static CardsAggregationModel Create(CardStatsModel[] cardStats)
        {
            var filteredCardStats = cardStats.Where(c => c.CycleTime.Ticks > 0).OrderByDescending(c => c.LastActivity).ToArray();

            return(new CardsAggregationModel
            {
                CardsStats = filteredCardStats,
                FullAggregationStats = AggregationTimeStats.Create(filteredCardStats),
                SAggregationStats = AggregationTimeStats.Create(filteredCardStats.Where(c => c.Size == CardSize.S).OrderByDescending(c => c.LastActivity)),
                MAggregationStats = AggregationTimeStats.Create(filteredCardStats.Where(c => c.Size == CardSize.M).OrderByDescending(c => c.LastActivity)),
                LAggregationStats = AggregationTimeStats.Create(filteredCardStats.Where(c => c.Size == CardSize.L).OrderByDescending(c => c.LastActivity)),
                XLAggregationStats = AggregationTimeStats.Create(filteredCardStats.Where(c => c.Size == CardSize.XL).OrderByDescending(c => c.LastActivity))
            });
        }
        private static ReportRow[] BuildAgregationStats(string header, AggregationTimeStats cardsAggregationStats)
        {
            if (cardsAggregationStats.AreEmpty())
            {
                return(new ReportRow[0]);
            }

            return(new[]
            {
                ReportRow.Create(header),
                ReportRow.Create("Average cycle time", FormatTimeSpan(cardsAggregationStats.AverageTime)),
                ReportRow.Create("Longest cycle time", FormatTimeSpan(cardsAggregationStats.LongestTimeCard.CycleTime), $"cardName {cardsAggregationStats.LongestTimeCard.Name}"),
                ReportRow.Create("Shortest cycle time", FormatTimeSpan(cardsAggregationStats.ShortestTimeCard.CycleTime), $"cardName {cardsAggregationStats.ShortestTimeCard.Name}"),
            });
        }