private function isDatabaseExist()
    {
        $databaseName = $this->getContainer()->getParameter('database_name');

        try {
            /** @var MySqlSchemaManager $schemaManager */
            $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager();
        } catch (\Exception $exception) {
            $message = "SQLSTATE[42000] [1049] Unknown database '%s'";
            if (false !== strpos($exception->getMessage(), sprintf($message, $databaseName))) {
                return false;
            }

            throw $exception;
        }

        try {
            return in_array($databaseName, $schemaManager->listDatabases());
        } catch(\PDOException $e) {
            return false;
        }
    }