/**
  * Returns board by Id
  * @param int $id
  * @return Ok
  * @throws NotFoundException
  */
 public function getById($id)
 {
     try {
         $board = $this->boardRepository->getBoardById($id);
     } catch (\OutOfBoundsException $e) {
         throw new NotFoundException($e->getMessage());
     }
     return new Ok($this->boardToJSON($board));
 }
 /**
  * Returns threads by board
  * @param $boardId
  * @param SeekableInterface $seek
  * @return Ok
  */
 public function getByBoardId($boardId, SeekableInterface $seek)
 {
     $board = $this->boardRepository->getBoardById($boardId);
     $threadsQuery = new ThreadListQuery($board, $seek);
     $threadsQuery->withAllPosts();
     $threadsQueryList = $this->threadRepository->getThreads($threadsQuery);
     $jsonResponse = ['items' => [], 'total' => $threadsQueryList->getTotal()];
     foreach ($threadsQueryList->getItems() as $thread) {
         $jsonResponse['items'][] = $this->convertThreadToJSON($thread);
     }
     return new Ok($jsonResponse);
 }