public function findOne(Repository $repository = null): Model
    {
        if (!$repository && !($repository = $this->repository)) {
            throw new \RuntimeException('The current Query object is not tied to any Repository');
        }

        return $repository->findOne($this->compileParameters());
    }