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

            FR_L5CU_GCGwCfT_1735 functionReturn = new FR_L5CU_GCGwCfT_1735();

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

                functionReturn = Execute(Connection, Transaction, 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 { }

                throw new Exception("Exception occured in method cls_Get_CustomerGroups_with_Customers_for_TenantID", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5CU_GCGwCfT_1735 Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5CU_GCGwCfT_1735();
            returnValue.Result = new L5CU_GCGwCfT_1735();
            //Put your code here

            var resListCustomers = new List <L5CU_GCGwCfT_1735a>();
            var resListGroups    = new List <L5CU_GCGwCfT_1735g>();

            var persons               = cls_Get_PersonCustomers_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;
            var companies             = cls_Get_CompanyCustomers_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result;
            var groupsWithAssignments = cls_Get_CustomerGroups_with_Assignment.Invoke(Connection, Transaction, securityTicket).Result;



            if (persons != null)
            {
                foreach (var p in persons)
                {
                    var item = new L5CU_GCGwCfT_1735a();
                    item.CMN_BPT_BusinessParticipantID = p.CMN_BPT_BusinessParticipantID;
                    item.CMN_BPT_CTM_CustomerID        = p.CMN_BPT_CTM_CustomerID;
                    item.FirstName = p.FirstName;
                    item.LastName  = p.LastName;
                    item.IsPerson  = true;
                    item.IfPerson_CMN_PER_PersonInfoID = p.CMN_PER_PersonInfoID;
                    item.InternalCustomerNumber        = p.InternalCustomerNumber;
                    item.DispayName = p.DisplayName;
                    resListCustomers.Add(item);
                }
            }
            if (companies != null)
            {
                foreach (var c in companies)
                {
                    var item = new L5CU_GCGwCfT_1735a();
                    item.CMN_BPT_BusinessParticipantID = c.CMN_BPT_BusinessParticipantID;
                    item.CMN_BPT_CTM_CustomerID        = c.CMN_BPT_CTM_CustomerID;
                    item.FirmName  = c.CompanyName_Line1;
                    item.IsCompany = true;
                    item.InternalCustomerNumber = c.InternalCustomerNumber;
                    item.DispayName             = c.DisplayName;
                    resListCustomers.Add(item);
                }
            }

            returnValue.Result.Customers = resListCustomers.OrderBy(l => l.LastName).ToArray();


            foreach (var groupWA in groupsWithAssignments)
            {
                var item = new L5CU_GCGwCfT_1735g();
                item.CMN_BPT_BP_GroupID                   = groupWA.CMN_BPT_BusinessParticipant_GroupID;
                item.BusinessParticipantGroup_Name        = groupWA.BusinessParticipantGroup_Name;
                item.BusinessParticipantGroup_Description = groupWA.BusinessParticipantGroup_Description;


                if (groupsWithAssignments.Any(x => x.Assignments.Any(y => resListCustomers.Any(z => z.CMN_BPT_BusinessParticipantID == y.CMN_BPT_BusinessParticipant_RefID))))
                {
                    var listGroupedCustomers = new List <L5CU_GCGwCfT_1735b>();
                    foreach (var cust in resListCustomers)
                    {
                        if (groupWA.Assignments.Any(x => x.CMN_BPT_BusinessParticipant_RefID == cust.CMN_BPT_BusinessParticipantID))
                        {
                            var customerInGroup = groupWA.Assignments.Where(x => x.CMN_BPT_BusinessParticipant_RefID == cust.CMN_BPT_BusinessParticipantID)
                                                  .Select(x => new L5CU_GCGwCfT_1735b {
                                CustomerID = cust.CMN_BPT_CTM_CustomerID
                            }).SingleOrDefault();
                            if (customerInGroup != null)
                            {
                                listGroupedCustomers.Add(customerInGroup);
                            }
                        }
                    }

                    item.GroupedCustomers = listGroupedCustomers.ToArray();
                }

                resListGroups.Add(item);
            }

            returnValue.Result.Groups = resListGroups.ToArray();

            return(returnValue);

            #endregion UserCode
        }