private static XmlResults InternalReplaceViewDependency(string oldAttributeName, string replaceAttributeName, ListViewItem item)
        {
            var objResult = new XmlResults(false);
            var objEnt    = (Entity)item.Tag;

            if (objEnt.Attributes.Contains("layoutxml"))
            {
                var layoutXml = (string)objEnt["layoutxml"];
                if (layoutXml.IndexOf(oldAttributeName, StringComparison.Ordinal) >= 0)
                {
                    objResult.IsPublish = true;
                    objResult.LayoutXml = layoutXml.Replace(oldAttributeName, replaceAttributeName);
                }
            }

            if (!objEnt.Attributes.Contains("fetchxml"))
            {
                return(objResult);
            }
            {
                var layoutXml = (string)objEnt["fetchxml"];
                if (layoutXml.IndexOf(oldAttributeName, StringComparison.Ordinal) < 0)
                {
                    return(objResult);
                }
                objResult.IsPublish   = true;
                objResult.OldFetchXml = layoutXml;
                objResult.FetchXml    = layoutXml.Replace(oldAttributeName, replaceAttributeName);
            }
            return(objResult);
        }
        private static XmlResults InternalDeleteViewDependency(string attributeName, ListViewItem item)
        {
            var objResult = new XmlResults(false);
            var objEnt    = (Entity)item.Tag;

            if (objEnt.Attributes.Contains("layoutxml"))
            {
                var layoutXml = (string)objEnt["layoutxml"];

                ////Remove Column from View
                var opResult = PerformXmlOperation(layoutXml, attributeName, "cell", "name");
                objResult.IsPublish = opResult.IsPublish;
                objResult.LayoutXml = opResult.PublishXml;
            }

            if (!objEnt.Attributes.Contains("fetchxml"))
            {
                return(objResult);
            }
            {
                //Remove Attribute from fetch xml
                var layoutXml = (string)objEnt["fetchxml"];
                var opResult  = PerformXmlOperation(layoutXml, attributeName, "attribute", "name");
                if (!objResult.IsPublish)
                {
                    objResult.IsPublish = opResult.IsPublish;
                }
                objResult.FetchXml = opResult.PublishXml;

                //Remove Condition from fetch xml
                opResult = PerformXmlOperation(objResult.FetchXml, attributeName, "condition", "attribute");
                if (!objResult.IsPublish)
                {
                    objResult.IsPublish = opResult.IsPublish;
                }
                objResult.FetchXml = opResult.PublishXml;
            }
            return(objResult);
        }