public function getInstance()
    {
        if (!$this->instance && $this->getType() && $this->getLocation()) {
            switch ($this->getType()) {
                case static::TYPE_SQLITE:
                    $instance = $this->createPDOSQLite(
                        $this->getLocation(),
                        $this->getErrorMode()
                    );
                    $this->setInstance($instance);
                    break;
                case static::TYPE_MYSQL:
                    if (!$this->getUsername() || !$this->getPassword() || !$this->getDatabase()) {
                        return null;
                    }
                    $instance = $this->createPDOMySQL(
                        $this->getLocation(),
                        $this->getDatabase(),
                        $this->getUsername(),
                        $this->getPassword(),
                        $this->getErrorMode(),
                        $this->getCharSet()
                    );
                    $this->setInstance($instance);
                    break;
                default:
                    throw new \Parable\ORM\Exception("Database type was invalid: {$this->getType()}");
            }
        }
        return $this->instance;
    }