private static void ProcessConnection(TcpClient client)
        {
            var networkService = new TOSNetworkService(client.Client);

            RegisterEverythingForService(networkService);
            lock (ClientsLock)
            {
                AllConnectedClients.Add(networkService);
            }

            networkService.OnDisconnected += delegate
            {
                lock (ClientsLock)
                {
                    AllConnectedClients.Remove(networkService);
                }
            };
        }
 private static void RegisterEverythingForService(TOSNetworkService service)
 {
     service.RegisterCallback(MessageType.RequestLoadHomepage, PacketHandler.HandleRequestLoadHomePage);
     service.RegisterCallback(MessageType.SendAccountSetting, PacketHandler.HandleSendAccountSetting);
 }