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

            FR_L5MC_MJGR_1414 functionReturn = new FR_L5MC_MJGR_1414();

            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 { }

                throw new Exception("Exception occured in method cls_Make_JoinGroup_Request", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5MC_MJGR_1414 Execute(DbConnection Connection, DbTransaction Transaction, P_L5MC_MJGR_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5MC_MJGR_1414();
            returnValue.Result = new L5MC_MJGR_1414();

            var community = ORM_HEC_CMT_Community.Query.Search(Connection, Transaction, new ORM_HEC_CMT_Community.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                IsCommunityOperatedByThisTenant = true
            }).Single();

            var role = ORM_HEC_CMT_OfferedRole.Query.Search(Connection, Transaction, new ORM_HEC_CMT_OfferedRole.Query()
            {
                GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(ECommunityRole.Contributor),
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID
            }).Single();

            var prevRequest = ORM_HEC_CMT_GroupSubscription_Request.Query.Search(Connection, Transaction, new ORM_HEC_CMT_GroupSubscription_Request.Query()
            {
                Tenant_RefID         = securityTicket.TenantID,
                IsDeleted            = false,
                IsApproved           = false,
                IsRequested          = false,
                Membership_RefID     = Parameter.HEC_CMT_MembershipID,
                CommunityGroup_RefID = Parameter.HEC_CMT_CommunityGroupID
            }).SingleOrDefault();

            var subscription = ORM_HEC_CMT_GroupSubscription.Query.Search(Connection, Transaction, new ORM_HEC_CMT_GroupSubscription.Query()
            {
                Tenant_RefID         = securityTicket.TenantID,
                IsDeleted            = false,
                Membership_RefID     = Parameter.HEC_CMT_MembershipID,
                CommunityGroup_RefID = Parameter.HEC_CMT_CommunityGroupID
            }).SingleOrDefault();

            if (subscription == null && prevRequest == null)
            {
                var request = new ORM_HEC_CMT_GroupSubscription_Request()
                {
                    HEC_CMT_GroupSubscription_RequestID = Guid.NewGuid(),
                    Tenant_RefID         = securityTicket.TenantID,
                    Membership_RefID     = Parameter.HEC_CMT_MembershipID,
                    CommunityGroup_RefID = Parameter.HEC_CMT_CommunityGroupID,
                    IsRequested          = true
                };
                request.Save(Connection, Transaction);

                var roleRequest = new ORM_HEC_CMT_OfferedRoles_2_GroupSubscriptionRequest()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    AssignmentID = Guid.NewGuid(),
                    HEC_CMT_OfferedRole_RefID = role.HEC_CMT_OfferedRoleID,
                    HEC_CMT_GroupSubscription_Request_RefID = request.HEC_CMT_GroupSubscription_RequestID
                };
                roleRequest.Save(Connection, Transaction);

                returnValue.Result.IsSuccess = true;
                returnValue.Result.HEC_CMT_GroupSubscription_RequestID = request.HEC_CMT_GroupSubscription_RequestID;
            }
            else
            {
                returnValue.Result.FailReason = new L5MC_MJGR_1414_FailReason()
                {
                    IfAlreadyGorupMember_GroupID = subscription == null ? Guid.Empty : subscription.HEC_CMT_GroupSubscriptionID,
                    IsAlreadyGorupMember         = subscription != null,
                    IsAlreadyRequested           = prevRequest != null,
                    IfAlreadyRequested_RequestID = prevRequest == null ? Guid.Empty : prevRequest.HEC_CMT_GroupSubscription_RequestID
                };
            }

            return(returnValue);

            #endregion UserCode
        }