/**
  * Adds the argument namespace of the current request to the specified arguments.
  * This happens recursively iterating through the nested requests in case of a subrequest.
  * For example if this is executed inside a widget sub request in a plugin sub request, the result would be:
  * array(
  *   'pluginRequestNamespace' => array(
  *     'widgetRequestNamespace => $arguments
  *    )
  * )
  *
  * @param array $arguments arguments
  * @param \TYPO3\Flow\Mvc\RequestInterface $currentRequest
  * @return array arguments with namespace
  */
 protected function addNamespaceToArguments(array $arguments, \TYPO3\Flow\Mvc\RequestInterface $currentRequest)
 {
     while (!$currentRequest->isMainRequest()) {
         $argumentNamespace = $currentRequest->getArgumentNamespace();
         if ($argumentNamespace !== '') {
             $arguments = array($argumentNamespace => $arguments);
         }
         $currentRequest = $currentRequest->getParentRequest();
     }
     return $arguments;
 }