def getLayerRootNode(self, lyr, rootNode):
        """
        Finds the database name of the layer and creates (if not exists)
        a node with the found name.
        lyr: (QgsVectorLayer)
        rootNode: (node item)
        """
        uriText = lyr.dataProvider().dataSourceUri()
        candidateUri = QgsDataSourceUri(uriText)
        rootNodeName = candidateUri.database()
        if not rootNodeName:
            rootNodeName = self.getRootNodeName(uriText)
        #creates database root
        return self.createGroup(rootNodeName, rootNode)