public void Update(Market market, bool fullSnapshot)
        {

            MergeSelectionStates(market, fullSnapshot);

            if (fullSnapshot)
            {
                _tags = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
                foreach (var key in market.TagKeys)
                    _tags.Add(key, market.GetTagValue(key));

                if (_tags.ContainsKey("traded_in_play"))
                    IsTradedInPlay = string.Equals(_tags["traded_in_play"], "true", StringComparison.InvariantCultureIgnoreCase);
            }
            
            // always set to false at each update
            IsForcedSuspended = false;

            market.IsPending = IsPending;
            market.IsActive = IsActive;
            market.IsResulted = IsResulted;
            market.IsSuspended = IsSuspended;
            market.IsTradedInPlay = IsTradedInPlay;
            market.IsVoided = IsVoided;

            UpdateLineOnRollingHandicap(market);
        }
        public bool IsEquivalentTo(Market market, bool checkTags, bool checkSelections)
        {
            if (market == null)
                return false;

            if (market.Id != Id)
                return false;

            if(checkTags)
            {
                if (market.TagsCount != TagsCount)
                    return false;

                if (market.TagKeys.Any(tag => !HasTag(tag) || GetTagValue(tag) != market.GetTagValue(tag)))
                    return false;
            }

            if (checkSelections)
            {
                if (Selections.Count() != market.Selections.Count())
                    return false;

                foreach (var seln in market.Selections)
                {
                    ISelectionState seln_state = this[seln.Id];
                    if (seln_state == null)
                        return false;

                    if (!seln_state.IsEquivalentTo(seln, checkTags))
                        return false;
                }
            }

            var result = IsSuspended == market.IsSuspended &&
                         IsActive == market.IsActive &&
                         IsResulted == market.IsResulted &&
                         IsPending == market.IsPending &&
                         IsVoided == market.IsVoided;


            if (IsRollingMarket)
                result &= Line == ((RollingMarket)market).Line;

            // the only case we really should pay attention
            // is when we have forced the suspension
            // when the market was active
            if(IsForcedSuspended)
                result &= market.IsSuspended;
            
            return result;
        }