public static void Alerts(this TempDataDictionary tempData, string message, AlertFlavor flavor = AlertFlavor.Info, bool isDismissable = false) { if (tempData == null) { throw new ArgumentNullException("tempData"); } var alerts = tempData.Alerts(true) ?? new List <AlertModel>(); alerts.Add(new AlertModel { Message = message, Flavor = flavor, IsDismissable = isDismissable, }); tempData[AlertKey] = alerts; }