/**
  * Allows to manage guests given by user
  * 
  * @param {stdClass} $data : Data set by user
  * @param {PadComponent} $pad : The pad
  * @return array 
  *              guests_changed (boolean) If guests have changed
  *              active_emails (array) List of active emails
  */
 private function manageUserGuests($data, $pad)
 {
     $activeEmails = array();
     $guestsChanged = false;
     if (isset($data->pad->guests)) {
         if (count($data->pad->guests) !== count($pad->guests)) {
             $guestsChanged = true;
         } else {
             // Check guest one by one
             foreach ($data->pad->guests as $i => $guest) {
                 if ($guest->active === true) {
                     $guestsChanged = true;
                     $activeEmails[] = $guest->email;
                 }
                 if (GuestComponent::getByEmail($guest->email) === false) {
                     $guestsChanged = true;
                 } else {
                     if ($pad->hasGuest($guest) === false) {
                         $guestsChanged = true;
                     }
                 }
             }
         }
     }
     return array('guests_changed' => $guestsChanged, 'active_emails' => $activeEmails);
 }
 /**
  * This function allwso to know if current pad has guest passed in parameters
  * 
  * @param GuestComponent $guest
  * @return boolean true if has,n false otherwhise
  */
 public function hasGuest($guest)
 {
     $tmpGuest = GuestComponent::getByEmail($guest->email);
     if ($tmpGuest) {
         $query = 'SELECT * FROM ' . PadGuestComponent::getDBTable() . " where pad_id = :pad_id AND guest_id = :guest_id ";
         $statement = DBI::prepare($query);
         $statement->execute(array('pad_id' => $this->id, 'guest_id' => $guest->id));
         $datas = $statement->fetch();
         if (is_array($datas)) {
             return true;
         }
     }
     return false;
 }