public void UpdateConversation(LyncConversation conv)
        {
            var activeParticipants = new List <Participant>();

            foreach (var participant in conv.conversation.Participants)
            {
                if (participant.IsSelf)
                {
                    continue;
                }

                activeParticipants.Add(participant);

                if (conv.participants.ContainsKey(participant))
                {
                    continue;
                }

                InstantMessageModality modality = (InstantMessageModality)participant.Modalities[ModalityTypes.InstantMessage];
                modality.InstantMessageReceived += imModality_InstantMessageReceived;

                conv.participants.Add(participant, new LyncParticipant {
                    modality = modality, participant = participant
                });
            }

            var deadParticipants = new List <Participant>();

            foreach (var participant in conv.participants.Keys)
            {
                if (!activeParticipants.Contains(participant))
                {
                    deadParticipants.Add(participant);
                }
            }

            foreach (var participant in deadParticipants)
            {
                conv.participants.Remove(participant);
            }

            conv.UpdateDesc();
        }
        public void UpdateConversation(LyncConversation conv)
        {
            var activeParticipants = new List<Participant>();
            foreach (var participant in conv.conversation.Participants)
            {
                if (participant.IsSelf)
                {
                    continue;
                }

                activeParticipants.Add(participant);

                if (conv.participants.ContainsKey(participant))
                {
                    continue;
                }

                InstantMessageModality modality = (InstantMessageModality)participant.Modalities[ModalityTypes.InstantMessage];
                modality.InstantMessageReceived += imModality_InstantMessageReceived;

                conv.participants.Add(participant, new LyncParticipant { modality = modality, participant = participant });
            }

            var deadParticipants = new List<Participant>();
            foreach (var participant in conv.participants.Keys)
            {
                if (!activeParticipants.Contains(participant))
                {
                    deadParticipants.Add(participant);
                }
            }

            foreach (var participant in deadParticipants)
            {
                conv.participants.Remove(participant);
            }

            conv.UpdateDesc();
        }
        public LyncConversation TrackConversation(Conversation conv)
        {
            var participants = new Dictionary<Participant, LyncParticipant>();
            foreach (var participant in conv.Participants)
            {
                if (participant.IsSelf)
                {
                    continue;
                }

                InstantMessageModality modality = (InstantMessageModality)participant.Modalities[ModalityTypes.InstantMessage];
                modality.InstantMessageReceived += imModality_InstantMessageReceived;

                participants.Add(participant, new LyncParticipant { modality = modality, participant = participant });
            }

            conv.ParticipantAdded += Conv_ParticipantAdded;
            conv.ParticipantRemoved += Conv_ParticipantRemoved;

            var lyncConv = new LyncConversation() { conversation = conv, participants = participants };

            lyncConv.UpdateDesc();

            return lyncConv;
        }