/**
  * @inheritDoc
  */
 public function createNewThread($boardId, $params)
 {
     $board = $this->repositories->boards()->find($boardId);
     if (!$board instanceof Board) {
         throw new \OutOfBoundsException(sprintf('Board with ID `%s` not found', $boardId));
     }
     $thread = new Thread();
     $thread->setBoard($board);
     $post = new Post();
     $post->setEmail($params['post']['email']);
     $post->setAuthor($params['post']['author']);
     $post->setContent($params['post']['content']);
     $post->setThread($thread);
     $thread->getPosts()->add($post);
     $em = $this->repositories->getEntityManager();
     $em->persist($post);
     $em->persist($thread);
     $em->flush();
     return $thread;
 }
 /**
  * @inheritDoc
  */
 public function getAllBoards()
 {
     return $this->repositories->boards()->findAll();
 }