public function filter(Model $model, $key = null)
    {
        if (is_null($this->filter)) {
            $this->filter = Filter::fromSchema($this->schema());
        }

        $this->applyHook('filtering', $model, $key);
        $result = $this->filter->run($model, $key);
        $this->applyHook('filtered', $model, $key);

        return $result;
    }