/// <summary>
        /// called when the peer send update message , and on the other peers when they received update
        /// </summary>
        /// <param name="stateMessage">the update message</param>
        void ISynchronizationBusinessLogic.OnUpdateReceived(BusinessLogicMessageBase stateMessage)
        {
            LogManager.GetCurrentClassLogger().Info("stateMessage: {0}", stateMessage);
            var myStateResponse = stateMessage as MyStateContainer;

            //full response
            if (myStateResponse != null)
            {
                UpdateState(myStateResponse.StateDictionary);
            }
        }
        /// <summary>
        /// Invoke when SynchronizationDetailsResponse operation received
        /// </summary>
        /// <param name="synchronizationDetailsResponse">the full detailed response</param>
        void ISynchronizationBusinessLogic.OnSynchronizationDetailsResponseReceived(BusinessLogicMessageBase synchronizationDetailsResponse)
        {
#if DEBUG
            LogManager.GetCurrentClassLogger().Debug("OnReceivedSynchronizationDetailsResponse: {0}", synchronizationDetailsResponse);
#endif
            var myStateResponse = synchronizationDetailsResponse as MyStateContainer;
            if (myStateResponse != null)
            {
                lock (syncLock)
                {
                    UpdateState(myStateResponse.StateDictionary);
                }
            }
        }
        /// <summary>
        /// Generate BusinessLogicMessageBase message that will be returned back to the mesh based on given synchronizationRequest with FullDetailedResponse set to true
        /// should override to produce application specific response
        /// </summary>
        /// <param name="synchronizationDetailsRequest">the detailed request received from the mesh contain the id's that should respond with full details (partial detailed response)</param>
        /// <returns>BusinessLogicMessageBase instance or null if don't want to response</returns>
        BusinessLogicMessageBase ISynchronizationBusinessLogic.ProvideSynchronizationDetailResponse(BusinessLogicMessageBase synchronizationDetailsRequest)
        {
#if DEBUG
            LogManager.GetCurrentClassLogger().Debug("ProvideSynchronizationDetailResponse: {0}", synchronizationDetailsRequest);
#endif
            if (synchronizationDetailsRequest is MyKeysStateIdsContainer)
            {
                var myKeysStateResponse = synchronizationDetailsRequest as MyKeysStateIdsContainer;
                lock (syncLock)
                {
                    //Filter the response to contain only the keys requested
                    var filtered = from myUserUpdateState in MyStateDictionary
                                   where myKeysStateResponse.StateIds.Contains(myUserUpdateState.Key)
                                   select myUserUpdateState;
                    var response = new MyStateContainer
                    {
                        StateDictionary = filtered.ToDictionary(x => x.Key, x => x.Value)
                    };
                    return(response);
                }
            }
            return(null);
        }
        /// <summary>
        /// Generate SynchronizationDetailsRequest message that will be send back to the mesh by the peer that want to synchronized itself based on given SynchronizationResponse message
        /// should override to produce application specific request
        /// </summary>
        /// <remarks>this method will invoked On sender peer based on prior SynchronizationResponse operation</remarks>
        /// <param name="synchronizationResponse">the response from the mesh</param>
        BusinessLogicMessageBase ISynchronizationBusinessLogic.ProvideSynchronizationDetailRequest(BusinessLogicMessageBase synchronizationResponse)
        {
#if DEBUG
            LogManager.GetCurrentClassLogger().Debug("ProvideSynchronizationDetailRequest: {0}", synchronizationResponse);
#endif
            var myStateResponse = synchronizationResponse as MyStateContainer;

            //full response
            if (myStateResponse != null)
            {
                UpdateState(myStateResponse.StateDictionary);
            }
            //partial keys only response
            else if (synchronizationResponse is MyKeysStateIdsContainer)
            {
                var myKeysStateResponse = synchronizationResponse as MyKeysStateIdsContainer;
                myKeysStateResponse.StateIds.SkipWhile(key => MyStateDictionary.ContainsKey(key));
                if (myKeysStateResponse.StateIds.Count > 0)
                {
                    return(myKeysStateResponse);
                }
            }

            /*
             * returning null would stop the synchronization process
             * in this case there is no need to continue the synchronization because already got the full details
             */
            return(null);
        }