public static T Replace <T>(this ApplicationDataContainer settings, string key, T value)
        {
            T original;

            settings.TryGetValue(key, out original);
            settings.Values[key] = typeof(T).GetTypeInfo().IsEnum ? (object)value.ToString() : value;
            return(original);
        }
        public static int Increment(this ApplicationDataContainer settings, string key)
        {
            Int32 value = 0;

            settings.TryGetValue(key, out value);
            value++;
            settings.Values[key] = value;
            return(value);
        }
        public static T CompareExchange <T>(this ApplicationDataContainer settings, string key, T value, T comparand)
        {
            T original;

            settings.TryGetValue(key, out original);

            // If they are equal, then replace the current value with the provided value
            if (original == null && comparand == null || (original != null && original.Equals(comparand)))
            {
                settings.Values[key] = value;
            }
            return(original);
        }
        public static TEnum TryGetEnumOrDefault <TEnum>(this ApplicationDataContainer settings, string key, TEnum defaultValue = default(TEnum))
            where TEnum : struct
        {
            string enumRawValue;
            TEnum  enumValue;

            if (settings.TryGetValue(key, out enumRawValue) && Enum.TryParse(enumRawValue, out enumValue))
            {
                return(enumValue);
            }

            return(defaultValue);
        }
        public static TValue TryGetOrDefault <TValue>(this ApplicationDataContainer settings, string key, TValue defaultValue = default(TValue))
        {
            TValue value;

            return(settings.TryGetValue(key, out value) ? value : defaultValue);
        }