Just use the Enabled property for MenuItem . There is not enough information to tell you how to build logic around it, but if you want to disable it, just do this:
menuItem.Enabled = false;
It should be noted that you will not need to continue to disconnect any children when you disconnect a parent, because with Enabled set to false he is not allowed to fly out of any children.
From the MSDN documentation for the Enabled property:
Gets or sets a value indicating whether the MenuItem object is enabled, allowing the item to display a pop-up image and any child menu items.
source share