diff --git a/src/Form/JobAbortForm.php b/src/Form/JobAbortForm.php
index 3b556a4..6c7a108 100644
--- a/src/Form/JobAbortForm.php
+++ b/src/Form/JobAbortForm.php
@@ -37,25 +37,10 @@ class JobAbortForm extends ContentEntityConfirmFormBase {
   public function submitForm(array &$form, FormStateInterface $form_state) {
     /** @var \Drupal\tmgmt\Entity\Job $entity */
     $entity = $this->entity;
-    if (!$entity->abortTranslation()) {
-      // This is the case when a translator does not support the abort
-      // operation.
-      // It would make more sense to not display the button for the action,
-      // however we do not know if the translator is able to abort a job until
-      // we trigger the action.
-      foreach ($entity->getMessagesSince() as $message) {
-        /** @var \Drupal\tmgmt\MessageInterface $message */
-        if ($message->getType() == 'debug') {
-          continue;
-        }
-        if ($text = $message->getMessage()) {
-          // We want to persist also the type therefore we will set the
-          // messages directly and not return them.
-          drupal_set_message($text, $message->getType());
-        }
-      }
-    }
-    else {
+    // It would make more sense to not display the button for the action,
+    // however we do not know if the translator is able to abort a job until
+    // we trigger the action.
+    if ($entity->abortTranslation()) {
       $entity->addMessage('The user ordered aborting the Job through the UI.');
     }
     tmgmt_write_request_messages($entity);
diff --git a/src/Form/JobItemAbortForm.php b/src/Form/JobItemAbortForm.php
index 7b3db1a..984ba18 100644
--- a/src/Form/JobItemAbortForm.php
+++ b/src/Form/JobItemAbortForm.php
@@ -40,17 +40,7 @@ class JobItemAbortForm extends ContentEntityConfirmFormBase {
     $entity = $this->entity;
     try {
       if (!$entity->abortTranslation()) {
-        foreach ($entity->getMessagesSince() as $message) {
-          /** @var \Drupal\tmgmt\MessageInterface $message */
-          if ($message->getType() == 'debug') {
-            continue;
-          }
-          if ($text = $message->getMessage()) {
-            // We want to persist also the type therefore we will set the
-            // messages directly and not return them.
-            drupal_set_message($text, $message->getType());
-          }
-        }
+        tmgmt_write_request_messages($entity);
       }
     }
     catch(TMGMTException $e) {
diff --git a/src/Form/JobItemForm.php b/src/Form/JobItemForm.php
index 976741f..1ef6d5e 100644
--- a/src/Form/JobItemForm.php
+++ b/src/Form/JobItemForm.php
@@ -558,7 +558,7 @@ class JobItemForm extends TmgmtFormBase {
   function ajaxReviewForm(array $form, FormStateInterface $form_state) {
     $key = array_slice($form_state->getTriggeringElement()['#array_parents'], 0, 2);
     $render_data = NestedArray::getValue($form, $key);
-    tmgmt_write_request_messages($form_state->getFormObject()->getEntity()->getJob());
+    tmgmt_write_request_messages($form_state->getFormObject()->getEntity());
     return $render_data;
   }
 
diff --git a/tmgmt.module b/tmgmt.module
index 0ed7917..1b8a003 100644
--- a/tmgmt.module
+++ b/tmgmt.module
@@ -693,15 +693,15 @@ function tmgmt_job_request_translation(JobInterface $job) {
 /**
  * Print all messages that occurred since our request to the screen.
  *
- * @param \Drupal\tmgmt\JobInterface $job
- *    The translation job for which the message should be written.
+ * @param \Drupal\tmgmt\JobInterface|\Drupal\tmgmt\JobItemInterface $job_or_job_item
+ *    The translation job or job item for which the message should be written.
  *
  * @return bool
  *    FALSE if there are message with severity error, TRUE otherwise.
  */
-function tmgmt_write_request_messages(JobInterface $job) {
+function tmgmt_write_request_messages($job_or_job_item) {
   $errors = FALSE;
-  foreach ($job->getMessagesSince() as $message) {
+  foreach ($job_or_job_item->getMessagesSince() as $message) {
     // Ignore debug messages.
     if ($message->getType() == 'debug') {
       continue;
@@ -813,7 +813,7 @@ function tmgmt_translation_review_form_update_state(array $form, FormStateInterf
     }
   }
   $job_item->save();
-  tmgmt_write_request_messages($job_item->getJob());
+  tmgmt_write_request_messages($job_item);
 }
 
 /**
diff --git a/translators/tmgmt_file/tmgmt_file.module b/translators/tmgmt_file/tmgmt_file.module
index fdf5ffb..8f98a52 100644
--- a/translators/tmgmt_file/tmgmt_file.module
+++ b/translators/tmgmt_file/tmgmt_file.module
@@ -56,15 +56,7 @@ function tmgmt_file_import_form_submit(array $form, FormStateInterface $form_sta
       }
     }
   }
-  foreach ($job->getMessagesSince() as $message) {
-    // Ignore debug messages.
-    if ($message->getType() == 'debug') {
-      continue;
-    }
-    if ($text = $message->getMessage()) {
-      drupal_set_message($text, $message->getType());
-    }
-  }
+  tmgmt_write_request_messages($job);
 }
 
 /**
