public void IncrementFactionUnreadMessageCount(long factionId, bool refresh)
        {
            var chatHistory = MyChatSystem.GetFactionChatHistory(MySession.Static.LocalPlayerId, factionId);

            if (chatHistory != null)
            {
                chatHistory.UnreadMessageCount++;
                if (refresh)
                {
                    UpdateFactionList(true);
                }
            }
        }
        private void RefreshFactionList()
        {
            var localFaction = MySession.Static.Factions.TryGetPlayerFaction(MySession.Static.LocalPlayerId);

            if (localFaction != null)
            {
                //Add local player faction first
                m_tempStringBuilder.Clear();
                m_tempStringBuilder.Append(localFaction.Name);

                var chatHistory = MyChatSystem.GetFactionChatHistory(MySession.Static.LocalPlayerId, localFaction.FactionId);
                if (chatHistory != null && chatHistory.UnreadMessageCount > 0)
                {
                    m_tempStringBuilder.Append(" (");
                    m_tempStringBuilder.Append(chatHistory.UnreadMessageCount);
                    m_tempStringBuilder.Append(")");
                }

                var item = new MyGuiControlListbox.Item(text: m_tempStringBuilder, userData: localFaction);
                m_factionList.Add(item);

                m_factionList.SetToolTip(string.Empty);
                foreach (var faction in MySession.Static.Factions)
                {
                    //Don't add local player faction twice
                    if (faction.Value != localFaction && faction.Value.AcceptHumans)
                    {
                        m_tempStringBuilder.Clear();
                        m_tempStringBuilder.Append(faction.Value.Name);

                        chatHistory = MyChatSystem.GetFactionChatHistory(MySession.Static.LocalPlayerId, faction.Value.FactionId);
                        if (chatHistory != null && chatHistory.UnreadMessageCount > 0)
                        {
                            m_tempStringBuilder.Append(" (");
                            m_tempStringBuilder.Append(chatHistory.UnreadMessageCount);
                            m_tempStringBuilder.Append(")");
                        }

                        item = new MyGuiControlListbox.Item(text: m_tempStringBuilder, userData: faction.Value);
                        m_factionList.Add(item);
                    }
                }
            }
            else
            {
                m_factionList.SelectedItems.Clear();
                m_factionList.Items.Clear();

                m_factionList.SetToolTip(MyTexts.GetString(MySpaceTexts.TerminalTab_Chat_NoFaction));
            }
        }