public function handle(ScheduleNextTasksForWorkflow $command)
 {
     $workflow = $this->workflowCollection->get($command->workflowId());
     if (is_null($workflow)) {
         throw WorkflowNotFound::withId($command->workflowId());
     }
     $previousTask = $this->taskCollection->get($command->previousTaskId());
     if (is_null($previousTask)) {
         throw TaskNotFound::withId($command->previousTaskId());
     }
     $previousMessageHandler = $this->messageHandlerCollection->get($previousTask->messageHandlerId());
     if (is_null($previousMessageHandler)) {
         throw MessageHandlerNotFound::withId($previousTask->messageHandlerId());
     }
     $nextMessageHandler = $this->messageHandlerCollection->get($command->nextMessageHandlerId());
     if (is_null($nextMessageHandler)) {
         throw MessageHandlerNotFound::withId($command->nextMessageHandlerId());
     }
     $nextTasks = $workflow->determineNextTasks($previousTask, $previousMessageHandler, $nextMessageHandler);
     foreach ($nextTasks as $nextTask) {
         $this->taskCollection->add($nextTask);
     }
 }