Create customer order in C# using IDO with NestedUpdates to also populate lines.

I'm trying to create sales orders using the /IDORequestService/ido/update/{ido} web service interface. I'm populating the order header IDO and also including 'NestedUpdates' for the line item data. The system responds with a successful response. The order header has been created, but the lines are not there. No error messages. Any ideas?

I'm trying to use the nested updates so that the whole order is created inside a transaction.

Trimmed code looks like this:

IDOUpdateItem idoItem = new IDOUpdateItem
{
Action = UpdateAction.Insert,
ItemID = "PBT=[SLCoAlls]",
UpdateLocking = UpdateLocking.Property
};

idoItem.Properties.Add(new IDOUpdateProperty("CoNum", "H000000001", true));
idoItem.Properties.Add(new IDOUpdateProperty("SiteRef", "Default", true));
idoItem.Properties.Add(new IDOUpdateProperty("CoAllCurrCode", "USD", true));
idoItem.Properties.Add(new IDOUpdateProperty("CustPo", "PO-Test", true));
idoItem.Properties.Add(new IDOUpdateProperty("CustNum", "CustNumber", true));
idoItem.Properties.Add(new IDOUpdateProperty("CustSeq", 0, true));

IDOUpdateItem lineData = new IDOUpdateItem(UpdateAction.Insert);
lineData.Properties.Add(new IDOUpdateProperty("CoNum", "H000000001", true));
lineData.Properties.Add(new IDOUpdateProperty("SiteRef", "Default", true));
lineData.Properties.Add(new IDOUpdateProperty("Item", "ItemIdValue", true));
lineData.Properties.Add(new IDOUpdateProperty("UM", "EA", true));
lineData.Properties.Add(new IDOUpdateProperty("QtyOrdered", 3, true));

IDOUpdateItems lines = new IDOUpdateItems();
lines.Add(lineData);

UpdateCollectionRequestData linesData = new UpdateCollectionRequestData
{
IDOName = "SLCoitemAlls",
RefreshAfterUpdate = true,
Items = lines
};

linesData.SetLinkBy("CoNum", "CoNum", "SiteRef", "SiteRef");

idoItem.NestedUpdates.Add(linesData);

listUpdateItems.Add(idoItem);

UpdateCollectionRequest request = new UpdateCollectionRequest { Changes = listUpdateItems };
string contentStr = JsonConvert.SerializeObject( request );

//Console.WriteLine( contentStr );

HttpResponseMessage response = client.PostAsync(requestUrl.ToString(), new StringContent(contentStr, Encoding.UTF8, "application/json")).Result;