public XElement BuildXML(QuickFix.Message msg,  MsgType msgType, DateTime? logTimeStamp = null, string origChkSum = null)
		{
			//Debug.WriteLine(" ~~~> " + msg.GetType().ToString());
			SessionID sessionID = msg.GetSessionID(msg);

			FIXClassInfo fixClass = null;
			if (msg.GetType() == typeof(QuickFix.Message))
			{
				var classes = fixClasses[msgType.ToString(), Utils.NormalizeFIXNameSpace(sessionID.BeginString)];
				if(classes != null && classes.Count>0)
					fixClass = classes[0];
			}

			//var root = new XElement(msg.GetType().ToString());
			var root = new XElement((fixClass!=null) ? fixClass.type.FullName : msg.GetType().ToString());
			root.Add(new XAttribute("MessageType", msgType.ToString()));
			root.Add(new XAttribute("Session", sessionID.ToString()));
			if(logTimeStamp.HasValue)
				root.Add(new XAttribute("LogTimeStamp", logTimeStamp.Value));	
			
			var header = new XElement(msg.Header.GetType().ToString());
			ProcessFieldMapToXML(header, msg.Header);
			root.Add(header);
			
			var body = new XElement(msg.GetType().ToString() + ".Body");
			ProcessFieldMapToXML(body, msg);
			root.Add(body);
			
			var trailer = new XElement(msg.Trailer.GetType().ToString());
			ProcessFieldMapToXML(trailer, msg.Trailer, origChkSum);
			root.Add(trailer);
			
			return root;
		}
        /*
         * //Sample
         * {
         *      "QuickFix.FIX44.ExecutionReport": {
         *  "MessageType":"QuickFix.FIX44.ExecutionReport",
         *  "Session":"FIX.4.4:BLP->MAP_GPSE_PRD",
         *  "LogTimeStamp":"2019-10-09T14:25:34.187Z",
         *  "Header": {
         *  }
         *  }
         * }
         */

        public string BuildJSON(QuickFix.Message msg, MsgType msgType, DateTime?logTimeStamp = null, string origChkSum = null)
        {
            //JObject jo = JObject.FromObject(fixMsg);
            //jo.Add("feeClass", "A");
            //string sJSON = jo.ToString();


            ////Debug.WriteLine(" ~~~> " + msg.GetType().ToString());
            SessionID sessionID = msg.GetSessionID(msg);

            FIXClassInfo fixClass = null;

            if (msg.GetType() == typeof(QuickFix.Message))
            {
                var classes = fixClasses[msgType.ToString(), Utils.NormalizeFIXNameSpace(sessionID.BeginString)];
                if (classes != null && classes.Count > 0)
                {
                    fixClass = classes[0];
                }
            }

            StringBuilder sb   = new StringBuilder();
            var           root = (fixClass != null) ? fixClass.type.FullName : msg.GetType().ToString();

            sb.Append("{");
            sb.Append($@"""{root}"":");
            sb.Append(FormatJSONPair("MessageType", msg.GetType().ToString()));
            sb.Append(FormatJSONPair("Session", sessionID.ToString()));
            sb.Append(FormatJSONPair("LogTimeStamp", logTimeStamp));

            ProcessFieldMapToJSON("Header", sb, msg.Header);
            ProcessFieldMapToJSON("Body", sb, msg);
            ProcessFieldMapToJSON("Trailer", sb, msg.Trailer, origChkSum);

            sb.Append("}");
            sb.Append("}");

            return(sb.ToString());
        }