protected override void OnReceived(byte[] buffer, long offset, long size)
        {
            Console.WriteLine(Encoding.UTF8.GetString(buffer, (int)offset, (int)size));
            ChatMsg model;

            if (SerializeUtilities.ChatMsgDeserializer(out model, Encoding.UTF8.GetString(buffer, (int)offset, (int)size)))
            {
                Program.chatMsgCollection.Add(model);
            }
        }
        protected override void OnReceived(byte[] buffer, long offset, long size)
        {
            {
                byte[] startBytes = new byte[4] {
                    0x89, 0x50, 0x4E, 0x47
                };
                byte[] finalBytes = new byte[8] {
                    0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82
                };

                byte[] itemValueNew = new byte[] { };
                if (concurrentDictionary.ContainsKey(this.Socket) == false)
                {
                    var startPos = FindPos(buffer, offset, size, startBytes, startBytes.Length);
                    var finalPos = FindPos(buffer, offset, size, finalBytes, finalBytes.Length);
                    if (startPos != (-1) && startPos < finalPos)
                    {
                        Array.Resize(ref itemValueNew, (int)(finalPos + finalBytes.Length - startPos));
                        System.Buffer.BlockCopy(buffer, (int)offset, itemValueNew, 0, (int)(finalPos + finalBytes.Length - startPos));
                        Program.blockingCollection.Add(itemValueNew);
                        //Program.concurrentQueue.Enqueue(itemValueNew);
                    }
                    else if (startPos != (-1))
                    {
                        Array.Resize(ref itemValueNew, (int)(size - startPos));
                        System.Buffer.BlockCopy(buffer, (int)offset, itemValueNew, 0, (int)(size - startPos));
                        concurrentDictionary.TryAdd(this.Socket, itemValueNew);
                    }
                    else
                    {
                        concurrentDictionary.TryAdd(this.Socket, itemValueNew);
                    }
                }
                else
                {
                    byte[] itemValue;
                    var    finalPos = FindPos(buffer, offset, size, finalBytes, finalBytes.Length);
                    if (finalPos != (-1))
                    {
                        concurrentDictionary.TryRemove(this.Socket, out itemValue);

                        Array.Resize(ref itemValueNew, (int)(itemValue.Length + finalPos + finalBytes.Length));
                        System.Buffer.BlockCopy(itemValue, 0, itemValueNew, 0, itemValue.Length);
                        System.Buffer.BlockCopy(buffer, (int)offset, itemValueNew, itemValue.Length, (int)(finalPos + finalBytes.Length));
                        Program.blockingCollection.Add(itemValueNew);
                        //Program.concurrentQueue.Enqueue(itemValueNew);
                    }
                    else
                    {
                        bool isItemExists = concurrentDictionary.TryGetValue(this.Socket, out itemValue);
                        Array.Resize(ref itemValueNew, (int)(itemValue.Length + size));
                        System.Buffer.BlockCopy(itemValue, 0, itemValueNew, 0, itemValue.Length);
                        System.Buffer.BlockCopy(buffer, (int)offset, itemValueNew, itemValue.Length, (int)size);
                        concurrentDictionary.TryUpdate(this.Socket, itemValueNew, itemValue);
                    }
                }
                if (itemValueNew.Length != 0)
                {
                    return;
                }
            }
            string message = System.Text.Encoding.UTF8.GetString(buffer, (int)offset, (int)size);

            Console.WriteLine("Incoming: " + message);

            ChatMsg model;

            if (SerializeUtilities.ChatMsgDeserializer(out model, message))
            {
                Program.chatMsgCollection.Add(model);
            }

            // Multicast message to all connected sessions
            Server.Multicast(message);

            // If the buffer starts with '!' the disconnect the current session
            if (message == "!")
            {
                Disconnect();
            }
        }