public function getDatabase($name = null, $doFinalInit = true)
    {
        // this is temporary until we'll have a clean solution
        // for packaging datamodels/requiring schemas
        if ($doFinalInit) {
            $this->doFinalInitialization();
        }

        if ($name === null) {
            return $this->dbList[0];
        }

        for ($i = 0, $size = count($this->dbList); $i < $size; $i++) {
            $db = $this->dbList[$i];
            if ($db->getName() === $name) {
                return $db;
            }
        }

        return null;
    }