public CandidateEventNotification recordNotification(
      final CandidateEvent candidateEvent, final Notification notification) {
    final CandidateEventNotification record = new CandidateEventNotification();
    record.setCandidateEvent(candidateEvent);

    record.setMessage(notification.getMessage());
    record.setNotificationLevel(notification.getNotificationLevel());
    record.setNotificationType(notification.getNotificationType());

    final QtiNode qtiNode = notification.getQtiNode();
    if (qtiNode != null) {
      record.setNodeQtiClassName(qtiNode.getQtiClassName());
      final XmlSourceLocationInformation sourceLocation = qtiNode.getSourceLocation();
      if (sourceLocation != null) {
        record.setSystemId(sourceLocation.getSystemId());
        record.setLineNumber(sourceLocation.getLineNumber());
        record.setColumnNumber(sourceLocation.getColumnNumber());
      }
    }
    final Attribute<?> attribute = notification.getAttribute();
    if (attribute != null) {
      record.setAttributeLocalName(attribute.getLocalName());
      record.setAttributeNamespaceUri(attribute.getNamespaceUri());
    }

    candidateEvent.getNotifications().add(record);
    candidateEventNotificationDao.persist(record);
    return record;
  }