/// <summary>
        /// Provides the ability to add an error as a Notification message with an optional error code.
        /// </summary>
        public static NotificationCollection AddError(this NotificationCollection instance, string error, string errorCode)
        {
            var notification = new Notification(error, NotificationSeverity.Error);

            if (errorCode.IsNotNullOrEmpty())
            {
                notification.Code = errorCode;
            }

            instance.AddMessage(notification);

            return(instance);
        }