private static bool ValuesAreEqual(Value value1, Value value2)
        {
            Dictionary<Type, ValueEqualityDelegate> switcher =
            new Dictionary<Type, ValueEqualityDelegate>();
              switcher.Add(typeof(TextValue), new ValueEqualityDelegate(TextValuesAreEqual));
              switcher.Add(typeof(NumberValue), new ValueEqualityDelegate(NumberValuesAreEqual));
              switcher.Add(typeof(BooleanValue), new ValueEqualityDelegate(BooleanValuesAreEqual));
              switcher.Add(typeof(DateTimeValue), new ValueEqualityDelegate(DateTimeValuesAreEqual));

              if (switcher.ContainsKey(value1.GetType())) {
            return switcher[value1.GetType()](value1, value2);
              }
              throw new NotImplementedException(String.Format("Unknown Value type {0}", value1.GetType()));
        }
 /// <summary>
 /// Gets the underlying value of the Value object.
 /// </summary>
 /// <value>The Value object to get the value from.</value>
 /// <returns>The underlying value.</returns>
 public static object GetValue(Value value)
 {
     PropertyInfo propInfo = value.GetType().GetProperty("value");
       if (propInfo != null) {
     return propInfo.GetValue(value, null);
       }
       return null;
 }