private void CreateGafRecordsByCADocuments(DocumentIDGroup documentIDGroup, GAFPeriod gafPeriod, out IList <PurchaseRecord> purchaseRecords, out IList <SupplyRecord> supplyRecords) { purchaseRecords = new List <PurchaseRecord>(); supplyRecords = new List <SupplyRecord>(); var caAdjs = _gafRepository.GetCAAdjsByIDs(documentIDGroup.DocumentType, documentIDGroup.RefNbrs.ToArray()); var caAdjGroupsByDrCr = caAdjs.GroupBy(caAdj => caAdj.DrCr); foreach (var caAdjGroupByDrCr in caAdjGroupsByDrCr) { var documentGroup = new DocumentGroup <CAAdj>() { Module = documentIDGroup.Module, DocumentType = documentIDGroup.DocumentType, DocumentsByRefNbr = caAdjGroupByDrCr.ToDictionary(caAdj => caAdj.AdjRefNbr, caAdj => caAdj) }; if (caAdjGroupByDrCr.Key == CADrCr.CACredit) { purchaseRecords = _caDocumentPurchaseGAFRecordsCreator.CreateGAFRecordsForDocumentGroup(documentGroup, gafPeriod.TaxAgencyID, gafPeriod.TaxPeriodID); } else { supplyRecords = _caDocumentSupplyGAFRecordsCreator.CreateGAFRecordsForDocumentGroup(documentGroup, gafPeriod.TaxAgencyID, gafPeriod.TaxPeriodID); } } }