/// <summary>
/// Helper function to recursively delete a sub-key (swallows errors in the
/// case of the sub-key not existing
/// </summary>
/// <param name="root">Root to delete key from</param>
/// <param name="subKey">Name of key to delete</param>
public static void DeleteSubKeyTree(RegistryKey root, string subKey)
{
// delete the specified sub-key if if exists (swallow the error if the
// sub-key does not exist)
try { root.DeleteSubKeyTree(subKey); }
catch (ArgumentException) { }
}