/**
  * Creates an Action with the given attributes and adds it to the rule.
  *
  * @param Rule $rule
  * @param string $type
  * @param string $method
  * @param string $parseExpression
  * @param string $url
  * @return Action
  */
 protected final function createAction(Rule $rule, $type, $method, $parseExpression, $url = NULL)
 {
     // fill array for action creation
     $actionAttributes = ['position' => $rule->actions()->count(), 'type' => $type, 'method' => $method, 'url' => $url, 'parse_expression' => $parseExpression];
     $action = new Action($actionAttributes);
     // add action to rule
     $rule->actions()->save($action);
     return $action;
 }