public override void Execute()
    {
        var channel = ChatServerData.ServerChannels.Find(c => c.ChannelId == Message.ChannelId);

        if (channel != null)
        {
            var member = channel.Members.Find(m => m.MemberId == Message.MemberId);
            if (member != null)
            {
                channel.Members.Remove(member);
                WritePlayerEventSignal.Dispatch(new WriteServerPlayerEventRequest()
                {
                    EventName = "PlayerLeftChat",
                    PlayFabId = Message.MemberId,
                    Body      = new Dictionary <string, object>()
                    {
                        { "ChannelId", channel.ChannelId }
                    }
                });
            }

            if (channel.Members.Count == 0 && channel.IsInviteOnly)
            {
                ChatServerData.ServerChannels.Remove(channel);
                WriteTitleEventSignal.Dispatch(new WriteTitleEventRequest()
                {
                    EventName = "ChatChannelRemoved",
                    Body      = new Dictionary <string, object>()
                    {
                        { "ChannelId", channel.ChannelId },
                        { "GameId", ServerSettings.GameId },
                        { "LastPlayer", Message.MemberId }
                    }
                });
            }
        }
    }
    public override void Execute()
    {
        var channel = ChatServerData.ServerChannels.Find(c => c.ChannelId == Message.ChannelId);

        if (channel == null)
        {
            var newChannel = new ChatChannel()
            {
                ChannelId    = Message.ChannelId,
                IsInviteOnly = Message.IsInviteOnly
            };
            newChannel.Members.Add(new ChatChannelMember()
            {
                MemberId   = Message.MemberId,
                MemberName = Message.MemberName
            });
            ChatServerData.ServerChannels.Add(newChannel);
            Signal.Dispatch(new CreateChannelResponseMessage()
            {
                MemberId  = Message.MemberId,
                ChannelId = newChannel.ChannelId,
                Created   = true
            });
            WriteTitleEventSignal.Dispatch(new WriteTitleEventRequest()
            {
                EventName = "NewChatChannelCreated",
                Body      = new Dictionary <string, object>()
                {
                    { "ChannelId", newChannel.ChannelId },
                    { "GameId", ServerSettings.GameId },
                    { "CreatedBy", Message.MemberId }
                }
            });
            WritePlayerEventSignal.Dispatch(new WriteServerPlayerEventRequest()
            {
                EventName = "PlayerJoinedChat",
                PlayFabId = Message.MemberId,
                Body      = new Dictionary <string, object>()
                {
                    { "ChannelId", newChannel.ChannelId },
                }
            });
            return;
        }
        else if (channel.IsInviteOnly)
        {
            Signal.Dispatch(new CreateChannelResponseMessage()
            {
                MemberId  = Message.MemberId,
                ChannelId = channel.ChannelId,
                Created   = false,
                Error     = "Channel already exists and you were not invited."
            });
        }
        else
        {
            channel.Members.Add(new ChatChannelMember()
            {
                MemberId   = Message.MemberId,
                MemberName = Message.MemberName
            });
            Signal.Dispatch(new CreateChannelResponseMessage()
            {
                MemberId  = Message.MemberId,
                ChannelId = channel.ChannelId,
                Created   = true
            });
            WritePlayerEventSignal.Dispatch(new WriteServerPlayerEventRequest()
            {
                EventName = "PlayerJoinedChat",
                PlayFabId = Message.MemberId,
                Body      = new Dictionary <string, object>()
                {
                    { "ChannelId", channel.ChannelId },
                }
            });
        }
    }