static function getDatabase($link)
    {
        // Determine the database abstraction layer
        if ($link instanceof \PDO) {
            $class = 'Pdo';
        } elseif ($link instanceof \Zend\Db\Adapter\Adapter) {
            $class = 'ZendDb2';
        } elseif ($link instanceof \Zend_Db_Adapter_Abstract) {
            $class = 'ZendDb';
        } elseif ($link instanceof \MDB2_Driver_Common) {
            $class = 'Mdb2';
        } else {
            throw new \InvalidArgumentException('Unsupported link type');
        }

        // Create matching link object
        $class = "Nada\Link\\$class";
        $link = new $class($link);

        // Create and return matching database object
        $class = 'Nada\Database\\' . $link->getDbmsSuffix();
        return new $class($link);
    }