public function applyMiddleware(...$names)
    {
        foreach ($names as $name) {
            if (!$this->_collection->middlewareExists($name)) {
                $message = "Cannot apply '$name' middleware or middleware group. " .
                    'Use registerMiddleware() to register middleware.';
                throw new RuntimeException($message);
            }
        }
        $this->middleware = array_unique(array_merge($this->middleware, $names));

        return $this;
    }