/**
  * Check if the current user can reach the next state given by the name
  * @param ModelInterface $model
  * @param $stateName
  * @throws WorkflowException
  * @return boolean
  */
 public function canReachNextState(ModelInterface $model, $stateName)
 {
     $currentModelState = $this->storage->findCurrentModelState($model, $this->process->getName());
     if (!$currentModelState instanceof ModelState) {
         throw new WorkflowException(sprintf('The given model has not started the "%s" process.', $this->process->getName()));
     }
     $currentStep = $this->getProcessStep($currentModelState->getStepName());
     if (!$currentStep->hasNextState($stateName)) {
         throw new WorkflowException(sprintf('The step "%s" does not contain any next state named "%s".', $currentStep->getName(), $stateName));
     }
     $state = $currentStep->getNextState($stateName);
     $step = $state->getTarget($model);
     return $this->canReachStep($model, $step);
 }