/**
  * Updates all Entries of a Contest with votecount and avg rating
  * 
  * @param \app\models\Contest $Contest Contest Object
  */
 private function UpdateContestEntries($Contest)
 {
     $Entries = Entry::findAll(['contest_id' => $Contest->id]);
     foreach ($Entries as $Entry) {
         $avgQuery = new Query();
         $avgQuery->from(Tweet::tableName())->where(['entry_id' => $Entry->id, 'needs_validation' => 0, 'old_vote' => 0]);
         $avgRating = $avgQuery->average('rating');
         $votestQuery = new Query();
         $votestQuery->from(Tweet::tableName())->where(['entry_id' => $Entry->id, 'needs_validation' => 0, 'old_vote' => 0]);
         $votes = $votestQuery->count();
         $Entry->votes = $votes;
         $Entry->avg_rating = round($avgRating, 2);
         $Entry->save();
     }
 }
 /**
  * Updates all Entry of the Tweet with votecount and avg rating
  * 
  * @param \app\models\Tweet $Tweet Tweet Object
  */
 private function UpdateEntry($Tweet)
 {
     $Entry = Entry::findOne($Tweet->entry_id);
     $avgQuery = new Query();
     $avgQuery->from(Tweet::tableName())->where(['entry_id' => $Entry->id, 'needs_validation' => 0, 'old_vote' => 0]);
     $avgRating = $avgQuery->average('rating');
     $votestQuery = new Query();
     $votestQuery->from(Tweet::tableName())->where(['entry_id' => $Entry->id, 'needs_validation' => 0, 'old_vote' => 0]);
     $votes = $votestQuery->count();
     $Entry->votes = $votes;
     $Entry->avg_rating = round($avgRating, 2);
     $Entry->save();
 }