private static bool ShouldSet(XmlNode templateNode, ISettingsDictionary dictionary, string name, object newValue, Unifiable oldValue, SubQuery query)
        {
            if (templateNode == null)
            {
                return(true);
            }
            bool canSet = query.UseDictionaryForSet(dictionary);

            ;
            bool onlyIfUnknown;

            if (StaticXMLUtils.TryParseBool(templateNode, "ifUnknown", out onlyIfUnknown))
            {
                if (onlyIfUnknown)
                {
                    return((Unifiable.IsMissing(oldValue) || IsIncomplete(oldValue)) && canSet);
                }
            }

            bool overwriteExisting;

            if (StaticXMLUtils.TryParseBool(templateNode, "overwriteExisting", out overwriteExisting))
            {
                if (!overwriteExisting)
                {
                    return((Unifiable.IsNullOrEmpty(oldValue) || IsIncomplete(oldValue)) && canSet);
                }
                //if (overwriteExisting)
                return(true);
            }

            string oldMatch  = StaticXMLUtils.GetAttribValue(templateNode, "existing", null);
            bool   shouldSet = true;

            if (oldMatch != null)
            {
                if (!StaticAIMLUtils.IsPredMatch(oldMatch, oldValue, null))
                {
                    shouldSet = false;
                }
            }
            var    newValueU = Unifiable.Create(newValue);
            string newMatch  = StaticXMLUtils.GetAttribValue(templateNode, "matches", null);

            if (newMatch != null)
            {
                if (!StaticAIMLUtils.IsPredMatch(newMatch, newValueU, null))
                {
                    shouldSet = false;
                }
            }
            string wontvalue = StaticXMLUtils.GetAttribValue(templateNode, "wontvalue", null);

            if (wontvalue != null)
            {
                if (StaticAIMLUtils.IsPredMatch(wontvalue, newValueU, null))
                {
                    shouldSet = false;
                }
            }
            return(shouldSet && canSet);
        }