private function getConfiguration($filepath, $output)
    {
        $outputWriter = new OutputWriter(
            function ($message) use ($output) {
                return $output->writeln($message);
            }
        );

        $info = pathinfo($filepath);
        $namespace = 'AntiMattr\MongoDB\Migrations\Configuration';
        $class = $info['extension'] === 'xml' ? 'XmlConfiguration' : 'YamlConfiguration';
        $class = sprintf('%s\%s', $namespace, $class);
        $configuration = new $class($this->documentManager->getDocumentManager()->getConnection(), $outputWriter);

        // register databsae name before loading to ensure that loading does not fail
        $configuration->setMigrationsDatabaseName($this->databaseName);

        // load additional config from migrations.(yml|xml)
        $configuration->load($filepath);

        return $configuration;
    }