/// <summary>
        /// Validate if database exist
        /// </summary>
        /// <returns></returns>
        protected bool DataBaseExist()
        {
            var sqlBuild = new TransactionConnectionString(DataBaseTypes, ConnectionString);

            if (string.IsNullOrEmpty(sqlBuild.InitialCatalog))
            {
                throw new EntityException("InitialCatalog, Database or DataSource  can not be null or empty");
            }

            var dbName = sqlBuild.InitialCatalog;

            if (DataBaseTypes == DataBaseTypes.Mssql)
            {
                sqlBuild.InitialCatalog = "";
                using (var rep = new DbRepository(sqlBuild.ToString(), DataBaseTypes))
                    return(rep.GetSqlCommand($"SELECT  CAST(CASE WHEN db_id(String[{dbName}]) is not null THEN 1 ELSE 0 END AS BIT)").ExecuteScalar().ConvertValue <bool>());
            }
            else if (DataBaseTypes == DataBaseTypes.Sqllight)
            {
                try
                {
                    using (var rep = new DbRepository(sqlBuild.ToString(), DataBaseTypes))
                        rep.ValidateConnection();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            else
            {
                sqlBuild.InitialCatalog = "";
                using (var rep = new DbRepository(sqlBuild.ToString(), DataBaseTypes))
                    return(rep.GetSqlCommand($"SELECT CAST(CASE WHEN datname is not null THEN 1 ELSE 0 END AS BIT) from pg_database WHERE lower(datname) = lower(String[{dbName}])").ExecuteScalar().ConvertValue <bool>());
            }
        }