async Task recivedMessage(MessagePayload message, WebSocket socket, int id)
        {
            using (var context = GameContext.getNew())
            {
                // First we check if this is a Login call, since they're always allowed
                var client = clients.ContainsKey(id) ? clients[id] : null;
                if (message.type == MessagePayloadType.Login)
                {
                    var newStatus = await LoginManager.login(message.payload);

                    if (newStatus == null)
                    {
                        await sendPayload("LoginManager login 0: Wrong login info", socket);
                    }
                    else
                    {
                        // Now we're signed in, so we create a client
                        User?currentUser = null;
                        try
                        {
                            currentUser = await context.users.SingleAsync(u => u.ID == newStatus.username);
                        }
                        catch { }
                        if (currentUser == null)
                        {
                            var user = new database.User(newStatus.username);
                            context.users.Add(user);
                            await context.SaveChangesAsync();

                            currentUser = user;
                        }
                        await sendPayload(message.payload, socket);

                        client      = new Client(newStatus.username, currentUser);
                        clients[id] = client;
                    }
                    return;
                    // We check if this user is signed in
                }
                else if (client != null)
                {
                    switch (message.type)
                    {
                    case MessagePayloadType.Campaign:
                        await sendPayload(await CampaignManager.accept(message.payload, client), client.user.ID);

                        break;

                    case MessagePayloadType.Character:
                        await sendPayload(await CharacterManager.accept(message.payload, client), client.user.ID);

                        break;

                    case MessagePayloadType.DiceRoll:
                        await sendPayload(await DiceRollManager.accept(message.payload, client), client.user.ID);

                        break;

                    case MessagePayloadType.Update:
                        await sendPayload(await GameState.gameStateFor(client), client.user.ID);

                        break;

                    default:
                        await sendPayload($"ClientManager recivedMessage 0: Invalid message type { message.type }", socket);

                        break;
                    }
                }
                else
                {
                    await sendPayload($"ClientManager recivedMessage 1: You must be signed in to use message type { message.type }", socket);
                }
            }
        }
 public Client(string socketID, database.User user)
 {
     this.socketID = socketID;
     this.user     = user;
 }