/**
  * Unregisters a control from the existing page hierarchy.
  *
  * This method unregisters a control and all its children recursively from
  * the existing page hierarchy. If the control implements certain interfaces
  * or extends from certain classes, it will also be unregistered from the page.
  * @param TControl the control to be removed
  */
 private function unregisterComponent($component)
 {
     if ($this->root instanceof TPage) {
         foreach ($component->children as $child) {
             $component->unregisterComponent($child);
         }
         if (class_exists('ICallbackEventHandler', FALSE)) {
             if ($this->root instanceof ICallbackEventHandler) {
                 $this->root->unregisterCallbackCandidate($this->root);
             }
             if ($component instanceof ICallbackEventHandler) {
                 $this->root->unregisterCallbackCandidate($component);
             }
         }
         if ($component instanceof IPostBackDataHandler) {
             $this->root->unregisterPostDataLoader($component);
         }
         if ($component instanceof IPostBackEventHandler) {
             $this->root->unregisterPostBackCandidate($component);
         }
         if ($component instanceof IValidator) {
             $this->root->unregisterValidator($component);
         }
         if ($component instanceof TContentPlaceHolder) {
             $this->root->unregisterContentPlaceHolder($component);
         }
         if ($component instanceof TForm) {
             $this->root->unsetForm($component);
         }
     }
     $component->uniqueID = '';
 }