public static void ValidateProperty(this KeyValuePair <XName, InstanceValue> property, bool allowDelete)
 {
     if (property.Key == null)
     {
         throw Fx.Exception.AsError(new InvalidOperationException(SRCore.MetadataCannotContainNullKey));
     }
     if (property.Value == null)
     {
         throw Fx.Exception.AsError(new InvalidOperationException(SRCore.MetadataCannotContainNullValue(property.Key)));
     }
     if (!allowDelete && property.Value.IsDeletedValue)
     {
         throw Fx.Exception.AsError(new InvalidOperationException(SRCore.InitialMetadataCannotBeDeleted(property.Key)));
     }
 }