private function databaseIdFromName($name)
    {
        try {
            $parsed = FirestoreGapicClient::parseName($name);
        } catch (ValidationException $e) {
            return null;
        }

        return isset($parsed['database'])
            ? $parsed['database']
            : null;
    }