public static bool DecodeMrnData(XmlFragmentList fragmentList, out MrnMsgList mrnList, out string errorMsg)
            {
                var result = Task.Run(() => DecodeMrnDataAsync(fragmentList)).Result;

                mrnList  = result.Item2;
                errorMsg = result.Item3;
                return(result.Item1);
            }
            public static async Task <Tuple <bool, MrnMsgList, string> > DecodeMrnDataAsync(XmlFragmentList fragmentList)
            {
                var mrnList  = new MrnMsgList();
                var errorMsg = string.Empty;
                await Task.Run(() =>
                {
                    try
                    {
                        List <XElement> elements;
                        foreach (var fragment in fragmentList.Fragments)
                        {
                            //process Attribues
                            if (string.IsNullOrEmpty(fragment.RawXmlData))
                            {
                                continue;
                            }

                            var list = XmlHelper.GetElement(fragment.RawXmlData, fragment.RdmMessageType);
                            elements = list.ToList();
                            if (!elements.Any())
                            {
                                continue;
                            }


                            var mrndata = new MrnMsg(StringtoType(fragment.RdmMessageType));

                            if (elements.First().HasAttributes)
                            {
                                var elementAttribs = new Dictionary <string, string>();
                                foreach (var attrib in elements.First().Attributes())
                                {
                                    elementAttribs.Add(attrib.Name.LocalName, attrib.Value);
                                }

                                // The following check is for EMA Java as it use domainType News_TEXT_ANALYTICS rather than RSSL_DMT_NEWS_TEXT_ANALYTICS as C++ and .NET
                                mrndata.DomainType = elementAttribs["domainType"] == "NEWS_TEXT_ANALYTICS"
                                    ? "RSSL_DMT_NEWS_TEXT_ANALYTICS"
                                    : elementAttribs["domainType"];
                                mrndata.SetFragmentAttribs(elementAttribs);
                            }

                            //process Key
                            var keys       = XmlHelper.GetElement(fragment.RawXmlData, "key");
                            var enumerable = keys.ToList();
                            if (enumerable.Any())
                            {
                                mrndata.ContainsKey = true;
                                var keysAttrib      = new Dictionary <string, string>();
                                foreach (var key in enumerable.First().Attributes())
                                {
                                    if (key.Name == "name")
                                    {
                                        mrndata.RequestKeyName = key.Value;
                                    }
                                    keysAttrib.Add(key.Name.LocalName, key.Value);
                                }

                                mrndata.SetKeyAtrribs(keysAttrib);
                            }

                            if (mrndata.DomainType == "RSSL_DMT_NEWS_TEXT_ANALYTICS" ||
                                mrndata.DomainType == "RSSL_DMT_MARKET_PRICE")
                            {
                                //process fieldList
                                var fields    = XmlHelper.GetElement(fragment.RawXmlData, "fieldEntry");
                                var xElements = fields.ToList();
                                if (xElements.Any())
                                {
                                    mrndata.ContainsFieldList = true;
                                    var fieldEntrys           = new Dictionary <int, string>();
                                    foreach (var elem in xElements)
                                    {
                                        var fid = from id in elem.Attributes()
                                                  where id.Name == "fieldId"
                                                  select id.Value;
                                        var fidId  = int.Parse(fid.First().Trim());
                                        var fValue = from fieldvalue in elem.Attributes()
                                                     where fieldvalue.Name == "data"
                                                     select fieldvalue.Value;
                                        var pBuffer = new string(fValue.First().ToCharArray()
                                                                 .Where(c => !char.IsWhiteSpace(c))
                                                                 .ToArray());
                                        //4271 is GUID.
                                        fieldEntrys.Add(fidId,
                                                        fidId == 4271
                                                ? Encoding.UTF8.GetString(
                                                            RdmDataConverter.StringToByteArray(pBuffer.Trim()))
                                                : pBuffer);
                                    }

                                    mrndata.SetFieldList(fieldEntrys);
                                }
                            }

                            mrndata.FragmentNumber = fragment.FragmentNumber;
                            mrnList.Add(fragment.FragmentNumber, mrndata);
                        }
                    }
                    catch (Exception ex)
                    {
                        errorMsg = $"DecodeMrnData error {ex.Message}\r\n{ex.StackTrace}";
                        return(new Tuple <bool, MrnMsgList, string>(false, mrnList, errorMsg));
                    }

                    return(new Tuple <bool, MrnMsgList, string>(true, mrnList, errorMsg));
                });

                return(new Tuple <bool, MrnMsgList, string>(true, mrnList, errorMsg));
            }