public static ReplicationRegion GetPrimaryRegion(string productName)
        {
            ReplicationRegion           primaryRegion  = null;
            Dictionary <string, string> primaryConfigs = MultiRegionConfig.GetConfigWithConfigKey(MultiRegionConfigTypes.PrimaryRegion, productName + "-RS-SQLCON");

            try
            {
                primaryConfigs.ForEach(config =>
                {
                    primaryRegion = new ReplicationRegion()
                    {
                        ConnectionString = config.Value,
                        isHealthy        = true,
                        RegionId         = Convert.ToInt32(config.Key.Split("~")[2]),
                        RegionKey        = config.Key.Split("~")[1]
                    };
                });

                if (primaryRegion != null)
                {
                    return(primaryRegion);
                }
                else
                {
                    throw (new Exception("Primary connection is not avaiable"));
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
        private static List <ReplicationRegion> GetSecondaryActiveRegions(string productName)
        {
            List <ReplicationRegion>    activeSecondryRegions = new List <ReplicationRegion>();
            Dictionary <string, string> secondaryConfigs      = MultiRegionConfig.GetConfigWithConfigKey(MultiRegionConfigTypes.SecondaryRegion, productName + "-RS-SQLCON");

            try
            {
                secondaryConfigs.ForEach(config =>
                {
                    activeSecondryRegions.Add(new ReplicationRegion()
                    {
                        ConnectionString = config.Value,
                        isHealthy        = true,
                        RegionId         = Convert.ToInt32(config.Key.Split("~")[2]),
                        RegionKey        = config.Key.Split("~")[1]
                    });
                });

                var retunRegions = activeSecondryRegions.Distinct().ToList();

                if (retunRegions.Count == 0)
                {
                    throw (new Exception("Atleast one Secondary Region is not avaiable"));
                }
                else
                {
                    return(retunRegions);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
        private static void UpdatePrimaryRegion(string productName, string uniqueId, string tableName)
        {
            Dictionary <string, string> primaryConfigs = MultiRegionConfig.GetConfigWithConfigKey(MultiRegionConfigTypes.PrimaryRegion, productName + "-RS-SQLCON");
            string        connectionString             = null;
            SqlConnection objSqlCon = null;

            primaryConfigs.ForEach(config => { connectionString = config.Value; });
            try
            {
                ReliableSqlDatabase sqlHelper = new ReliableSqlDatabase(connectionString);
                objSqlCon = (SqlConnection)sqlHelper.CreateConnection();
                objSqlCon.Open();
                SqlCommand objSqlCommand = new SqlCommand("UPDATE " + tableName + " SET isReplicated = 1 where Guid = '" + uniqueId + "'");
                objSqlCommand.CommandType = CommandType.Text;
                objSqlCommand.Connection  = objSqlCon;
                objSqlCommand.ExecuteNonQuery();
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally
            {
                if (objSqlCon.State == ConnectionState.Open)
                {
                    objSqlCon.Close();
                }
            }
        }