public function detach(ObserverInterface $observer)
    {
        $observers = $this->getObservers();

        foreach ($observer->getEvents() as $event) {
            $count = count($observers[$event]);

            for ($i = 0; $i < $count; $i++) {
                if ($observers[$event][$i] == $observer) {
                    unset($observers[$event][$i]);
                }
            }
        }

        $this->setObservers($observers);
    }