public ServerMessage CreateMessage(byte[] bytes)
        {
            var messageType = (bytes?.FirstOrDefault() ?? 0).GetMessageType();

            switch (messageType)
            {
            case ServerMessageType.PlayerJoined:
                var playerJoinedMessage = new PlayerJoinedMessage(bytes);
                Players.Add(playerJoinedMessage.Player);
                return(playerJoinedMessage);

            case ServerMessageType.StartOfGame:
                Players.Clear();
                ResetGameTime();
                return(new StartOfGameMessage(bytes));

            case ServerMessageType.StartOfDay:
            case ServerMessageType.StartOfNight:
                Trial.Clear();
                MoveTimeForward();
                return(new MoveTimeForwardMessage(bytes));

            case ServerMessageType.PlayerVote:
                var playerVoteMessage = new PlayerVoteMessage(bytes);
                Trial.AddVote(playerVoteMessage);
                return(playerVoteMessage);

            case ServerMessageType.PlayerOnStand:
                var playerOnStandMessage = new PlayerOnStandMessage(bytes);
                Trial.SetPlayerOnStand(playerOnStandMessage);
                return(playerOnStandMessage);

            case ServerMessageType.VoteVerdict:
                var voteVerdictMessage = new VoteVerdictMessage(bytes);
                Trial.AddVerdict(voteVerdictMessage);
                return(voteVerdictMessage);

            case ServerMessageType.PlayerIsGuilty:
            case ServerMessageType.PlayerIsInnocent:
                Trial.Complete();
                return(new ServerMessage(bytes));

            case ServerMessageType.Chat: return(new ChatMessage(bytes));

            case ServerMessageType.PlayerDead: return(new PlayerDeadMessage(bytes));

            case ServerMessageType.LocalPlayerReport: return(new LocalPlayerReportMessage(bytes));

            case ServerMessageType.MafiaPlayersReport: return(new MafiaPlayersReportMessage(bytes));

            case ServerMessageType.MayorRevealed: return(new MayorRevealedMessage(bytes));

            case ServerMessageType.PlayerRevived: return(new PlayerRevivedMessage(bytes));

            default: return(new ServerMessage(bytes));
            }
        }
 public void AddVote(PlayerVoteMessage message) => _votes.Add(message);