/// <summary>
        /// Фиксирует принятый пакет.
        /// Дожидается оставшихся пакетов, если такие имееются,
        /// либо же десериализирует данные и передает их в обработку всем подсписчикам события "ClientReceivedMessage"
        /// </summary>
        private static void ReceiveCallback(IAsyncResult ar)
        {
            try
            {
                var state     = (ClientStateObject)ar.AsyncState;
                var socket    = state.Client.Socket;
                var bytesRead = socket.EndReceive(ar);

                if (bytesRead > 0)
                {
                    state.ReceivedBytes.AddRange(state.Buffer.Take(bytesRead));
                }

                if (state.MessageReceived)
                {
                    var messageType = (MessageType)state.ReceivedBytes[MessageExtensions.HEADER_LENGTH];
                    var message     = SerializeManager.Deserialise(messageType, state.ReceivedBytes.ToArray());

                    EventManager.RaiseOnMainThread(EventType.ReceivedMessage, messageType, message, state.Client);

                    state.Client._receiveDone.Set();
                }
                else
                {
                    socket.BeginReceive(state.Buffer, 0, state.Buffer.Length, 0, ReceiveCallback, state);
                }
            }
            catch (SocketException se)
            {
                if (se.ErrorCode == 0x80004005)
                {
                    var state = (ClientStateObject)ar.AsyncState;
                    state.Client.SafeDispose();
                    //ToDo: mb reconnect?
                }
            }
            catch (Exception e)
            {
                Debug.Log(e);
            }
        }