private function buildDatasourceInstance($sourceName, Logger $logger) {
        $parser = new YAMLParser($logger);
        $ymlFilePath = __SITE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'credentials.yml';
        $parser->setFilePath($ymlFilePath);
        $dsConfig = $parser->loadConfig();
        $sourceName = trim($sourceName, "<br>");

        $datasourceClass = $dsConfig['database'][$sourceName]['class'];

        $datasource = new $datasourceClass($dsConfig['database'][$sourceName]['credentials']);
        $datasource->setLogger($logger);
   
        unset($parser);
        
        return $datasource;
    }