public function extract(callable $callback = null)
    {
        $this->response = Di::getDefault()->get('response');

        if ($callback === null) {
            $this->response->setContent(json_encode($this->result->toArray()));
        }

        else {
            $this->response->setContent($callback(
                json_encode($this->result->toArray())
            ));
        }

        $this->response->send();

    }