I am doing a upsert operation using soap api, but I need sort the sobject in which all parent should be upserted first and the their children. i.e if Lead object is depend on Acount object and contact object is depends on both Account and Lead object. Account should be upserted first, Lead should be second and Contact should be at last. when I use describeglobal() method, but it is sorted based on the name.
Is there any way we can sort based on the relationship ? I am working from C# code.