public function getModel()
    {
        if ($this->model == null) {
            $name = $this->relation->getReferencedModel();
            $this->model = new $name();
        }
        return $this->model;
    }