private async Task Import(Stream inputFile, Stream outputFile, CancellationToken ct) { var tariffsProviders = GetTariffsProviders(); try { var shippingService = new ShippingService ( new XmlParcelsProvider(inputFile), tariffsProviders, new XmlDeliveriesStore(outputFile) ); var parcels = await shippingService.GetParcels(new ParcelsQuery(), ct); await shippingService.CreateDeliveryReport(parcels, new DeliveryOptions(), ct); } finally { tariffsProviders.ForEach(p => p.Dispose()); } }