private bool IsNameValidForAdd(string name, PropertyBagContents content, out string errorMessage)
        {
            errorMessage = string.Empty;

            if (!MatsUtils.IsValidPropertyName(name, out errorMessage))
            {
                return(false);
            }

            if (!IsPropertyNameUnique(name, content))
            {
                errorMessage = string.Format(CultureInfo.InvariantCulture, "Property Name '{0}' is not unique", name);
                return(false);
            }

            return(true);
        }
        private bool IsValidExistingName <T>(ConcurrentDictionary <string, T> map, string key, out string errorMessage)
        {
            errorMessage = string.Empty;

            if (!MatsUtils.IsValidPropertyName(key, out errorMessage))
            {
                return(false);
            }

            if (!map.ContainsKey(MatsUtils.NormalizeValidPropertyName(key, out errorMessage)))
            {
                errorMessage = string.Format(CultureInfo.InvariantCulture, "Property '{0}' does not exist in the property map", key);
                return(false);
            }

            return(true);
        }