public void HandleSystemMessage(EntitySystemData sysMsg)
        {
            Int32 messageLength = sysMsg.message.ReadInt32();

            object deserialized = Serializer.Deserialize(new MemoryStream(sysMsg.message.ReadBytes(messageLength)));

            if (deserialized is EntitySystemMessage)
            {
                foreach (KeyValuePair <Type, EntitySystem> current in _systemMessageTypes.Where(x => x.Key == deserialized.GetType()))
                {
                    current.Value.HandleNetMessage((EntitySystemMessage)deserialized);
                }
            }
        }
        public void HandleSystemMessage(EntitySystemData sysMsg)
        {
            int messageLength = sysMsg.message.ReadInt32();
            EntitySystemMessage deserialized;

            using (var stream = new MemoryStream(sysMsg.message.ReadBytes(messageLength)))
            {
                deserialized = serializer.Deserialize <EntitySystemMessage>(stream);
            }

            foreach (var current in SystemMessageTypes.Where(x => x.Key == deserialized.GetType()))
            {
                current.Value.HandleNetMessage((EntitySystemMessage)deserialized);
            }
        }