protected function initRepository() {
        if ($this->model === null ||
                ($this->model !== null && !in_array('DScribe\Core\IModel', class_implements($this->model))))
            return false;

        if ($this->repository !== null && $this->model->getTableName() === $this->repository->getTableName())
            return true;

        $repository = ($this->repositoryClass !== null) ? $this->repositoryClass : 'DBScribe\Repository';
        $this->repository = new $repository($this->model, engineGet('DB'), true);
    }