protected static FR_L5RL_GRFC_1352 Execute(DbConnection Connection, DbTransaction Transaction, P_L5RL_GRFC_1352 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5RL_GRFC_1352();
            returnValue.Result = new L5RL_GRFC_1352();

            L5RL_GRFT_0942[] allReligions = cls_Get_Religions_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result;

            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
            countryQuery.IsDeleted    = false;
            countryQuery.Tenant_RefID = securityTicket.TenantID;

            ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

            ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
            country2EconomicRegionQuery.CMN_Country_RefID = country.CMN_CountryID;
            country2EconomicRegionQuery.IsDeleted         = false;
            country2EconomicRegionQuery.Tenant_RefID      = securityTicket.TenantID;

            ORM_CMN_Country_2_EconomicRegion country2EconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery).FirstOrDefault();

            if (country2EconomicRegion == null)
            {
                return(returnValue);
            }

            ORM_CMN_PER_Religion_2_EconomicRegion.Query religion2EconomicRegionQuery = new ORM_CMN_PER_Religion_2_EconomicRegion.Query();
            religion2EconomicRegionQuery.CMN_EconomicRegion_RefID = country2EconomicRegion.CMN_EconomicRegion_RefID;
            religion2EconomicRegionQuery.IsDeleted    = false;
            religion2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;

            List <ORM_CMN_PER_Religion_2_EconomicRegion> listOfReligion2EconomicRegion = ORM_CMN_PER_Religion_2_EconomicRegion.Query.Search(Connection, Transaction, religion2EconomicRegionQuery);

            List <L5RL_GRFT_0942> resultReligions = new List <L5RL_GRFT_0942>();

            if (allReligions != null)
            {
                foreach (var religion2EconomicRegion in listOfReligion2EconomicRegion)
                {
                    resultReligions.Add(allReligions.FirstOrDefault(x => x.CMN_PER_ReligionID == religion2EconomicRegion.CMN_PER_Religion_RefID));
                }
            }
            else
            {
                return(returnValue);
            }

            returnValue.Result.Religion = resultReligions.ToArray();

            return(returnValue);

            #endregion UserCode
        }
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5RL_GRFC_1352 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5RL_GRFC_1352 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5RL_GRFC_1352 functionReturn = new FR_L5RL_GRFC_1352();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);


                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                Guid errorID = Guid.NewGuid();
                ServerLog.Instance.Fatal("Application error occured. ErrorID = " + errorID, ex);
                throw ex;
            }
            return(functionReturn);
        }