public static void SetValues(object obj, PropertyCollection properties) {
            if (obj == null)
                throw new ArgumentNullException("obj");
            if (properties == null) {
                return;
            }

            foreach (string name in properties.GetAllKeys()) {
                TrySetValue(obj, name, properties[name]);
            }
        }