private ICollection<PaymentBundle> CreateBundles(AlphaFileHeader header, List<AlphaPaymentRecord> records)
 {
     return new List<PaymentBundle>
         {
             new PaymentBundle(header.AccountNumber, header.PaymentDate, header.Currency,
                 records.Select(record => new PaymentRecord(record.Amount, record.Reference)))
         };
 }
        private void ValidateContents(AlphaFileHeader header, List<AlphaPaymentRecord> records)
        {
            if (header.Quantity != records.Count)
                throw new InconsistentFileContentsException($"Incorrect quantity of payments in file. Expected {header.Quantity} but file contained {records.Count}. File provided by {RawPaymentProvider}"); 

            var sumOfRecords = records.Count > 0 ? records.Sum(r => r.Amount) : 0;
            if (sumOfRecords != header.Amount)
                throw new InconsistentFileContentsException($"Incorrect total payment amount in file. Expected {header.Amount} but file contained {sumOfRecords}. File provided by {RawPaymentProvider}"); 
        }
        private AlphaFileHeader ReadHeader()
        {
            if(!RawPaymentProvider.HasMoreRecords)
                throw new BadFileFormatException($"Could not locate header in alpha payment file provided from {RawPaymentProvider}");

            var rawHeader = RawPaymentProvider.ReadNextRecord();

            var result = new AlphaFileHeader(rawHeader);
            return result;
        }