/**
  * Returns number of affected rows
  * 
  * @param \Wonderland\Application\Model\Member $member
  * @param int $id
  * @param string $vote
  * @return int
  */
 public function voteMotion(Member $member, $id, $vote)
 {
     $date = date('Y-m-d h-i-s');
     $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'inconnue';
     $statement = $this->connection->prepareStatement('INSERT INTO motions_votes_jetons (Motion_id, Citizen_id, Date, Ip) ' . 'VALUES (:motion_id, :citizen_id, :date, :ip)', ['motion_id' => $id, 'citizen_id' => $member->getId(), 'date' => $date, 'ip' => $ip]);
     if ($statement->rowCount() === 0) {
         return 0;
     }
     $choice = $vote === 'approved' ? 1 : 2;
     $hash = hash('sha512', "{$this->connection->lastInsertId()}#{$id}#{$member->getIdentity()}#{$choice}#{$date}#{$ip}");
     $statement = $this->connection->prepareStatement('INSERT INTO motions_votes(Motion_id, Choix, Hash)  VALUES (:id, :choice, :hash)', ['id' => $id, 'choice' => $choice, 'hash' => $hash]);
     return $statement->rowCount();
 }