public function addTask($script, $parameters, $priority)
 {
     $queue = new Entity\Queue();
     $queue->setParameters(json_encode($parameters));
     $queue->setPriority($priority);
     $queue->setService($script);
     $queue->setStatus(self::STATUS_NEW);
     $em = $this->_doctrine->getManager();
     $em->persist($queue);
     $em->flush();
     return $queue;
 }