public function performFilter($filter)
    {
        $filter = $this->getFilter($filter);

        if (!$filter) {
            throw new \Exception('Filter not found', 500);
        }

        if ($filter instanceof \Closure) {
            call_user_func($filter);
            return $this->setAppliedFilter($filter);
        }

        if (is_array($filter)) {
            list($class, $method) = $filter;
            if (!class_exists($class)) {
                throw new \Exception('Invalid filter class', 500);
            }

            $class = $this->app->make($class);
            call_user_func([$class, $method]);
            return $this->setAppliedFilter($filter);
        }

        throw new \Exception('Invalid filter', 500);
    }