// ***********************Functions***********************

        public XElement SerializeMatchingData(Model.MatchingData matchingData)
        {
            XElement xMatchingData = new XElement("matchingdata",
                                                  new XElement("comparedefinitions", matchingData.CompareDefinitions.Select(cmd =>
                                                                                                                            this.SerializeCompareDefinition(cmd)
                                                                                                                            )),
                                                  new XElement("keydefinitions", matchingData.KeyDefinitions.Select(cmd =>
                                                                                                                    this.SerializeKeyDefinition(cmd)
                                                                                                                    ))
                                                  );

            return(xMatchingData);
        }
        public Model.MatchingData DeserializeMatchingData(XElement xMatchingData)
        {
            var matchingData = new Model.MatchingData();

            if (xMatchingData == null)
            {
                return(matchingData);
            }

            foreach (XElement xCompareDef in xMatchingData.Element("comparedefinitions").Elements())
            {
                matchingData.CompareDefinitions.Add(this.DeserializeCompareDefinition(xCompareDef));
            }

            foreach (XElement xKeyDef in xMatchingData.Element("keydefinitions").Elements())
            {
                matchingData.KeyDefinitions.Add(this.DeserializeKeyDefinition(xKeyDef));
            }

            return(matchingData);
        }