public function clear($type = null)
    {
        if (is_null($type)) {
            $this->notifications = new Collection();
        } else {
            $notifications = new Collection();

            foreach ($this->notifications as $message) {
                if ($message->getType() != $type) {
                    $notifications->add($message);
                }
            }

            $this->notifications = $notifications;
        }

        return $this;
    }