private static WidgetModel GetModelFromType(Type type)
{
var widgetAttributes = type.GetCustomAttributes(typeof(WidgetAttribute), true);
var typeHasAttributes = (widgetAttributes.Count() > 0 && widgetAttributes is WidgetAttribute[]);
if (!typeHasAttributes)
throw new ArgumentException("A widget was passed without class attributes");
var model = ModelFromAttributes(((WidgetAttribute[])widgetAttributes)[0], type);
return model;
}