private async Task RemoveCloudServiceTurnedAvailabilitySetFromARMTree(AvailabilitySet availabilitySet) { if (availabilitySet != null) { if (availabilitySet.SourceAvailabilitySet != null && availabilitySet.SourceAvailabilitySet.GetType() == typeof(Azure.Asm.CloudService)) { TreeNode targetResourceGroupNode = SeekResourceGroupTreeNode(); if (targetResourceGroupNode != null) { TreeNode[] matchingNodes = targetResourceGroupNode.Nodes.Find(availabilitySet.ToString(), true); foreach (TreeNode matchingNode in matchingNodes) { if (matchingNode.Tag != null && matchingNode.Tag.GetType() == typeof(Azure.MigrationTarget.AvailabilitySet) && String.Compare(((Azure.MigrationTarget.AvailabilitySet)matchingNode.Tag).SourceName, availabilitySet.SourceName, true) == 0) { await RemoveTreeNodeCascadeUp(matchingNode); } } } } } }