/**
  * Parses the content into the Event.
  *
  * @param  string     $prizes
  * @throws \Exception
  */
 private function parsePrizes($prizes)
 {
     try {
         $prizes = json_decode($prizes);
         foreach ($prizes->prizes as $item) {
             $prize = new Prize();
             $prize->setSponsorName($item->sponsor);
             $prize->setPrizeTitle($item->prize);
             $prize->setTweetMessage($item->tweet_message);
             $this->event->addPrize($prize);
         }
     } catch (\Exception $error) {
         throw new \Exception($error->getMessage());
     }
 }
 /**
  * Parses the json data into an Event object
  *
  * @param $data
  *
  * @return Event
  */
 private function parseEventFromJson($data)
 {
     $dataObj = json_decode($data);
     $event = new Event($dataObj->event->id);
     if (isset($dataObj->event->attendees)) {
         // cleans the array
         $attendees = array_filter($dataObj->event->attendees);
         foreach ($attendees as $item) {
             $attendee = new Attendee();
             $attendee->setId($item->id);
             $attendee->setName($item->name);
             $attendee->setEmail($item->email);
             if (isset($item->twitterHandler) && !empty($item->twitterHandler)) {
                 $attendee->setTwitterHandler($item->twitterHandler);
             }
             $event->addAttendee($attendee);
         }
     }
     if (isset($dataObj->event->prizes)) {
         // cleans the array
         $prizes = array_filter($dataObj->event->prizes);
         foreach ($prizes as $item) {
             $prize = new Prize();
             $prize->setSponsorName($item->sponsor);
             $prize->setPrizeTitle($item->prize);
             if (isset($item->winner)) {
                 $attendee = new Attendee();
                 $attendee->setId($item->winner->id);
                 $prize->setWinner($attendee);
             }
             if (isset($item->tweet_message)) {
                 $prize->setTweetMessage($item->tweet_message);
             }
             $event->addPrize($prize);
         }
     }
     return $event;
 }