public string AddUserToTable(string tableId, Guid userId, WebSocket socket) { Locker.EnterWriteLock(); try { if (string.IsNullOrEmpty(tableId)) { tableId = _generator.GenerateShortUniqueId(); } var user = new User { Name = string.Empty, Socket = socket }; if (Tables.ContainsKey(tableId)) { Tables[tableId].Add(userId, user); } else { Tables.Add(tableId, new Dictionary <Guid, User> { { userId, user } }); } } finally { Locker.ExitWriteLock(); } return(tableId); }