public void RunInventoryReceiptImport(string warehouseId, long shopifyProductId, List <ShopifyVariant> variants) { var inventoryForSyncing = variants.SelectMany(x => x.ShopifyInventoryLevels).ToList(); // Push Inventory Receipt to Acumatica API // var receipt = BuildReceipt(warehouseId, inventoryForSyncing); if (receipt.ControlQty.value == 0) { // Empty Receipt return; } // Execution logging... // var shopifyProduct = _syncRepository.RetrieveProduct(shopifyProductId); var msg = $"Creating Inventory Receipt for {shopifyProduct.LogDescriptor()} ({variants.Count} variants)"; _logService.Log(msg); // Create Inventory Receipt in Acumatica // var resultJson = _distributionClient.AddInventoryReceipt(receipt.SerializeToJson()); var resultObject = resultJson.DeserializeFromJson <InventoryReceipt>(); // Create Monster Record // var monsterReceipt = new AcumaticaInventoryReceipt(); monsterReceipt.AcumaticaRefNumber = resultObject.ReferenceNbr.value; monsterReceipt.IsReleased = false; monsterReceipt.DateCreated = DateTime.UtcNow; monsterReceipt.LastUpdate = DateTime.UtcNow; // No transaction - keep writing until you can't write no mo'! // _inventoryRepository.InsertInventoryReceipt(monsterReceipt); foreach (var level in inventoryForSyncing) { _syncRepository.InsertInventoryReceiptSync(level, monsterReceipt); } }