/**
  * @param OutputInterface $output
  */
 private function findCommunities(OutputInterface $output)
 {
     $this->logger->addInfo('Finding new communities');
     $communities = array();
     try {
         for ($page = 1; $page <= 20; $page++) {
             $responseMessage = $this->parseService->getPage($this->makeCommunitiesMoreUrl(), true, $this->makeCommunitiesUrl(), array('t:zone' => 'bunchZone', 'bunchIndex' => $page));
             $response = json_decode($responseMessage);
             if (!$response) {
                 $this->logger->addInfo(sprintf('Empty page %s', $page));
                 break;
             }
             $pageCommunities = $this->parseService->getCommunities($response->content);
             $this->logger->addInfo(sprintf('Page %s parsed successful, get %s communities', $page, count($pageCommunities)));
             $communities = $communities + $pageCommunities;
             usleep(rand(500, 1500) * 1000);
         }
     } catch (RuntimeException $e) {
         $this->logger->addInfo('Exception: ' . $e->getMessage() . ' ' . $e->getCode());
     }
     foreach ($communities as $parsedCommunity) {
         $community = $this->pantheonRepository->find($parsedCommunity->id);
         if ($community) {
             continue;
         }
         $community = new Pantheon();
         $community->setId($parsedCommunity->id)->setImg($parsedCommunity->pic)->setName($parsedCommunity->name)->setIsActive(0)->setUpdatedAt(new DateTime());
         $this->em->persist($community);
     }
     $this->em->flush();
 }