diff --git a/src/Batch.php b/src/Batch.php
index 73cc279..54d5947 100644
--- a/src/Batch.php
+++ b/src/Batch.php
@@ -171,16 +171,11 @@ class Batch {
         $priority = $batch_info['entity_types'][$bundle_entity_type][$bundle_name]['entities'][$row->$id_field]['priority'];
       }
 
-      // Setting route parameters if they exist in the database (menu links).
-      if (isset($route_params_field) && !empty($route_parameters = unserialize($row->$route_params_field))) {
-        $route_parameters = array(key($route_parameters) => $route_parameters[key($route_parameters)]);
-      }
-      elseif (!empty($info['path_info']['entity_type'])) {
-        $route_parameters = array($info['path_info']['entity_type'] => $row->$id_field);
-      }
-      else {
-        $route_parameters = array();
+      if (!isset($route_params_field)) {
+        $route_params_field = NULL;
       }
+      // Gets route parameters, if they exist in the database (menu links).
+      $route_parameters = self::getRouteParameters($row, $info, $id_field, $route_params_field);
 
       // Getting the name of the options field if any.
       if (!empty($info['field_info']['options'])) {
@@ -236,7 +231,37 @@ class Batch {
     self::processSegment($context, $batch_info);
   }
 
- /**
+  /**
+   * Gets route parameters, if they exist in the database (menu links).
+   *
+   * @param $row
+   *   An individual row from the results fetched by the queries that are built
+   *   in the plugins.
+   * @param $info
+   *   An associative array of information built by the plugins.
+   * @param $id_field
+   *   The id field of the entity corresponding to the defined plugins.
+   * @param $route_params_field
+   *   The name of the route parameters field if exists in the database.
+   * @return array
+   *   Returns an associative array of parameters, if it exists.
+   */
+  public static function getRouteParameters($row, $info, $id_field, $route_params_field) {
+    // Setting route parameters if they exist in the database (menu links).
+    if (isset($route_params_field)) {
+      $route_parameters = unserialize($row->$route_params_field);
+    }
+    elseif (!empty($info['path_info']['entity_type'])) {
+      $route_parameters = array($info['path_info']['entity_type'] => $row->$id_field);
+    }
+    else {
+      $route_parameters = array();
+    }
+
+    return $route_parameters;
+  }
+
+  /**
    * Batch function which generates urls to custom paths.
    *
    * @param array $custom_paths
