/// <summary>
        /// Load and execute engine rules
        /// </summary>
        public void ProcessBoardBaggageTTY(OSUSR_UUK_BAGMSGS bag, OSUSR_UUK_BAGINTEG bagIntegraty, OSUSR_UUK_FLT_INFO flightInfoI, OSUSR_UUK_FLT_INFO flightInfoF, String hub, ISessionFactory factory)
        {
            BagTMLog.LogDebug("BagTM Engine Process Board Baggage Start", this);

            try
            {
                List <OSUSR_UUK_BAGMSGS> listOfBagBoarded = this.SearchBaggageMsgsByFlightandSeatNumber(bag);

                foreach (OSUSR_UUK_BAGMSGS boardBag in listOfBagBoarded)
                {
                    OSUSR_UUK_BAGINTEG boardBagInteg = this.SearchBaggageIntegratyByBagIdentifier(boardBag.NBAGTAG + boardBag.NNRTAGS);

                    if (boardBagInteg == null)
                    {
                        boardBagInteg = new OSUSR_UUK_BAGINTEG();
                    }

                    var inst = bag.GetType().GetMethod("MemberwiseClone", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
                    OSUSR_UUK_BAGMSGS bagClone = (OSUSR_UUK_BAGMSGS)inst.Invoke(bag, null);

                    bagClone.NNRTAGS = boardBag.NNRTAGS;
                    bagClone.NBAGTAG = boardBag.NBAGTAG;

                    BagTMLog.LogDebug("BagTM Board Baggage Engine Rules Execution", this);
                    // Run engine process rules
                    this.EngineRulesExecution(bagClone, boardBagInteg, flightInfoI, flightInfoF, hub, factory);
                }
            }
            catch (Exception e)
            {
                BagTMLog.LogError("BagTM Engine Error Process Board Baggage", this, e);

                throw e;
            }

            BagTMLog.LogDebug("BagTM Engine Process Board Baggage Ending", this);
        }
        /// <summary>
        /// Process engine rules
        /// </summary>
        /// <param name="messageObject"></param>
        /// <param name="n"></param>
        public void ProcessBaggageTTYEngine(Object messageObject, int n)
        {
            BagTMLog.LogDebug("BagTM Engine Baggage TTY", this);

            // Only process message if is a baggage message
            if (messageObject.GetType() != typeof(OSUSR_UUK_BAGMSGS))
            {
                throw new EngineProcessingException("Not a baggage message.");
            }

            OSUSR_UUK_BAGMSGS bag = (OSUSR_UUK_BAGMSGS)messageObject;

            int nrtag = 0;

            try
            {
                nrtag = Convert.ToInt32(bag.NNRTAGS);
            }
            catch (Exception e)
            {
                BagTMLog.LogError("Bag NNRTAG is not an number.", bag, e);
            }
            if (nrtag > 1)
            {
                for (int i = 0; i < nrtag; i++)
                {
                    var inst = bag.GetType().GetMethod("MemberwiseClone", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
                    OSUSR_UUK_BAGMSGS bagClone = (OSUSR_UUK_BAGMSGS)inst.Invoke(bag, null);

                    bagClone.NNRTAGS = "001";
                    bagClone.NBAGTAG = (Convert.ToDecimal(bagClone.NBAGTAG) + i).ToString("0000000000");
                    ProcessBaggageTTYEngine(bagClone, n);
                }
            }

            BagTMLog.LogDebug("BagTM Engine Search BaggageIntegraty", bag);
            // Obtain baggage from Baggage Integraty table
            OSUSR_UUK_BAGINTEG bagIntegraty = this.SearchBaggageIntegratyByBagIdentifier(bag.NBAGTAG + bag.NNRTAGS);

            if (bagIntegraty == null)
            {
                bagIntegraty = new OSUSR_UUK_BAGINTEG();
            }
            BagTMLog.LogDebug("BagTM Engine Search BaggageIntegraty Found ", bagIntegraty);
            BagTMLog.LogDebug("BagTM Engine Search FlightInfoI and FlightInfoF", this);
            OSUSR_UUK_FLT_INFO flightInfoI = null;
            OSUSR_UUK_FLT_INFO flightInfoF = null;

            bool isHub              = false;
            bool isLocalTTYforHub   = false;
            bool isLocalEndingInHub = false;

            if ((BagTMRulesActions.hubBagParameter.Equals(bag.VBAGSOURCIND) &&
                 this.hub.Equals(bag.VCITY)) ||
                (BagTMRulesActions.localBagParameter.Equals(bag.VBAGSOURCIND) &&
                 this.hub.Equals(bag.FDEST)))
            {
                isHub = true;
            }
            if (isHub && BagTMRulesActions.localBagParameter.Equals(bag.VBAGSOURCIND))
            {
                isLocalTTYforHub = true;
            }
            if (isHub && isLocalTTYforHub && (bag.OFLTNR == null || !bag.OFLTNR.StartsWith(this.airline)))
            {
                isLocalEndingInHub = true;
            }
            if (isHub && !isLocalTTYforHub && bag.IFLTNR != null)
            {
                isLocalEndingInHub = true;
            }

            // Obtain list of message from Baggage table
            if (isHub)
            {
                if (!isLocalEndingInHub)
                {
                    if (bag.FFLTNR != null && bag.FDATE != null && bag.FFLTNR.StartsWith(this.airline))
                    {
                        flightInfoI = this.SearchFlightInfo(bag.FFLTNR, bag.FDATE, bag.VCITY, bag.FDEST);
                    }
                    else
                    {
                        flightInfoI = new OSUSR_UUK_FLT_INFO();
                    }
                    if (bag.OFLTNR != null && bag.ODATE != null && bag.OFLTNR.StartsWith(this.airline))
                    {
                        flightInfoF = this.SearchFlightInfo(bag.OFLTNR, bag.ODATE, hub, bag.ODEST);
                    }
                    else
                    {
                        flightInfoF = new OSUSR_UUK_FLT_INFO();
                    }
                }
                else
                {
                    if (bag.IFLTNR != null && bag.IDATE != null && bag.IFLTNR.StartsWith(this.airline))
                    {
                        flightInfoI = this.SearchFlightInfo(bag.IFLTNR, bag.IDATE, bag.IORIGIN, bag.VCITY);
                    }
                    else
                    {
                        flightInfoI = new OSUSR_UUK_FLT_INFO();
                    }
                    if (bag.FFLTNR != null && bag.FDATE != null && bag.FFLTNR.StartsWith(this.airline))
                    {
                        flightInfoF = this.SearchFlightInfo(bag.FFLTNR, bag.FDATE, bag.VCITY, bag.FDEST);
                    }
                    else
                    {
                        flightInfoF = new OSUSR_UUK_FLT_INFO();
                    }
                }
            }
            else
            {
                if (bag.FFLTNR != null && bag.FDATE != null && bag.FFLTNR.StartsWith(this.airline))
                {
                    flightInfoF = this.SearchFlightInfo(bag.FFLTNR, bag.FDATE, bag.VCITY, bag.FDEST);
                }
                else
                {
                    flightInfoF = new OSUSR_UUK_FLT_INFO();
                }

                flightInfoI = new OSUSR_UUK_FLT_INFO();
            }

            BagTMLog.LogDebug("BagTM Engine Search FlightInfoI", flightInfoI);
            BagTMLog.LogDebug("BagTM Engine Search FlightInfoF", flightInfoF);
            BagTMLog.LogDebug("BagTM Engine Rules Execution", this);
            // Run engine process rules
            this.EngineRulesExecution(bag, bagIntegraty, flightInfoI, flightInfoF, hub, factory);

            // Verify if is a baggage board
            if (BagTMRulesActions.PAX_BOARDED_STATUS.Equals(bag.SPAXCK))
            {
                BagTMLog.LogDebug("BagTM Engine Boaded Pax", this);

                this.ProcessBoardBaggageTTY(bag, bagIntegraty, flightInfoI, flightInfoF, hub, factory);
            }

            if (flightInfoF == null || flightInfoF.FLT_NR == null || flightInfoI == null)
            {
                BagTMLog.LogDebug("No update to H2H since no flight information, please check flight in FLT_INFO table.", this);
            }
            else
            {
                // Reprocess Hull 2 Hull table for selected flight
                if (isHub || (hub.Equals(bag.VCITY) && BagTMRulesActions.localBagParameter.Equals(bag.VBAGSOURCIND)))
                {
                    this.h2hProcessing.EngineUpdateH2H(flightInfoI, flightInfoF, isHub);
                }
            }
            BagTMLog.LogDebug("BagTM Engine Baggage TTY End", this);
        }