/**
  * Updates the task status
  *
  * @param WorkPackage $task
  * @param string $status
  * @return void
  * @throws TaskQueueServiceException
  */
 private function updateTaskStatus(WorkPackage $task, $status)
 {
     if ($this->databaseDisabled) {
         return;
     }
     $taskEntity = $task->getTaskEntity();
     if ($taskEntity instanceof Task) {
         $taskEntity->setStatus($status);
         //make sure it is stored...
         $this->entityManager->flush($taskEntity);
     } else {
         throw new TaskQueueServiceException("Entity is not of type Task");
     }
 }