public Transaction[] GetMany(ReportSubject subject, Filters filters)
        {
            switch (subject)
            {
            case ReportSubject.Cards:
                return(transactions.Values.Where(t => t.CardId != null && SelectTransaction(t, filters)).ToArray());

            case ReportSubject.Loans:
            case ReportSubject.Payments:
                return(transactions.Values.Where(t => t.PaymentId != null && SelectTransaction(t, filters)).ToArray());

            case ReportSubject.Transactions:
                return(transactions.Values.Where(t => SelectTransaction(t, filters)).ToArray());

            default:
                throw new InvalidOperationException("Unknown subject of report.");
            }
        }
        public static string SerializerOverallReport(ReportSubject subject, DateTime?from, DateTime?to, ReportGranularity granularity, OverallReportPortion[] portions)
        {
            var sb = new StringBuilder();

            sb.AppendLine($"Raport całościowy dla; {subject}");
            sb.AppendLine($"Zakres od; {from?.ToString() ?? "-"}");
            sb.AppendLine($"Zakres do; {to?.ToString() ?? "-"}");
            sb.AppendLine($"Granularność; {granularity}");

            var groupedPortions = portions.GroupBy(p => p.Period);
            var ordered         = groupedPortions.OrderBy(p => p.Key);

            foreach (var portion in ordered)
            {
                sb.AppendLine(portion.Key);
                foreach (var aggregation in portion)
                {
                    sb.WriteAggragation(portion.Key, aggregation.Value, aggregation.Aggregation);
                }
            }

            return(sb.ToString());
        }