private IXmlChange GetXmlChange(XmlModelChange modelChange)
        {
            IXmlChange result = null;

            if (_changeMap.TryGetValue(modelChange, out result))
            {
                return(result);
            }

            if (result == null)
            {
                var addChange = modelChange as AddNodeChange;
                if (addChange != null)
                {
                    result = new VSXmlAddNodeChange(addChange);
                }
            }

            if (result == null)
            {
                var removeChange = modelChange as RemoveNodeChange;
                if (removeChange != null)
                {
                    result = new VSXmlRemoveNodeChange(removeChange);
                }
            }

            if (result == null)
            {
                var nodeNameChange = modelChange as NodeNameChange;
                if (nodeNameChange != null)
                {
                    result = new VSXmlNodeNameChange(nodeNameChange);
                }
            }

            if (result == null)
            {
                var nodeValueChange = modelChange as NodeValueChange;
                if (nodeValueChange != null)
                {
                    result = new VSXmlNodeValueChange(nodeValueChange);
                }
            }

            if (result != null)
            {
                _changeMap[modelChange] = result;
            }

            return(result);
        }
        private IXmlChange GetXmlChange(XmlModelChange modelChange)
        {
            IXmlChange result = null;
            if (_changeMap.TryGetValue(modelChange, out result))
            {
                return result;
            }

            if (result == null)
            {
                var addChange = modelChange as AddNodeChange;
                if (addChange != null)
                {
                    result = new VSXmlAddNodeChange(addChange);
                }
            }

            if (result == null)
            {
                var removeChange = modelChange as RemoveNodeChange;
                if (removeChange != null)
                {
                    result = new VSXmlRemoveNodeChange(removeChange);
                }
            }

            if (result == null)
            {
                var nodeNameChange = modelChange as NodeNameChange;
                if (nodeNameChange != null)
                {
                    result = new VSXmlNodeNameChange(nodeNameChange);
                }
            }

            if (result == null)
            {
                var nodeValueChange = modelChange as NodeValueChange;
                if (nodeValueChange != null)
                {
                    result = new VSXmlNodeValueChange(nodeValueChange);
                }
            }

            if (result != null)
            {
                _changeMap[modelChange] = result;
            }

            return result;
        }