class AppUtils {

    @SuppressWarnings("unchecked")
    public void addNotification(final RedirectAttributes redirectAttributes, final Notification notification) {
        List<Notification> notifications = new LinkedList<>();

        if (redirectAttributes.getFlashAttributes().containsKey(NOTIFICATION_LIST_ATTRIBUTE)) {
            notifications = (List<Notification>) redirectAttributes.getFlashAttributes()
                .get(NOTIFICATION_LIST_ATTRIBUTE);
        }

        notifications.add(notification);
        redirectAttributes.addFlashAttribute(NOTIFICATION_LIST_ATTRIBUTE, notifications);
    }

}