public function getRepository($name = null)
    {
        $name = strtolower($name);

        if ($name) {
            if (isset($this->repositories[$name])) {
                return $this->repositories[$name];
            }

            return $this->getNullRepository();
        }

        return $this->repository ?: $this->getNullRepository();
    }