public static ModelMetadata Metadata(this IModel model) { var metadata = ModelMetadata.Find(model); if (metadata == null) { throw new Exception($"Metadata not loaded for model with type {model.GetType()}"); } return(metadata); }