public function offsetUnset($offset) {
        $detach = NULL;

        if(parent::offsetExists($offset)) {
            $child = parent::offsetGet($offset);
            if($child instanceof Element && $child->__parent === $this) {
                $detach = $child;
            }
        }

        parent::offsetUnset($offset);

        if($detach) {
            $detach->detach();
        }
    }