public void Run(params string[] args) { DN to_delete = PhoneSystem.Root.GetDNByNumber(args[1]); if (to_delete is Extension) { to_delete.Delete(); while (PhoneSystem.Root.GetDNByNumber(args[1]) != null) { //ObjectModel do not delete object immediatelly. So deleted object //may be alive for some short period of time. Only after receiving //notification event 'Deleted' from Object Model - the object was removed. Console.WriteLine("Extension " + args[1] + " still alive..."); Thread.Sleep(500); } Console.WriteLine("Extension " + args[1] + " now deleted"); } }