/**
  * @todo: Consider putting this into activity component
  * @todo: I doubt this code will ever get reused anywhere else, might as well put it back where it came from
  * @param $data
  * @param $bonus
  * @return ActivityEntity
  * @since 0.0.6
  */
 private function createActivityFromData($data, $bonus)
 {
     $user = Apollo::getInstance()->getUser();
     $activity = new ActivityEntity();
     $activity->setOrganisation($user->getOrganisation());
     $activity->setName($data['activity_name']);
     $start_date = new DateTime($data['start_date']);
     $end_date = new DateTime($data['end_date']);
     $activity->setStartDate($start_date);
     $activity->setEndDate($end_date);
     if ($bonus) {
         if (!empty($bonus['people'])) {
             $activity->addPeople($bonus['people']);
         }
         if (!empty($bonus['target_group'])) {
             $activity->setTargetGroup($bonus['target_group']);
         }
         if (!empty($bonus['target_group_comment'])) {
             $activity->setTargetGroupComment($bonus['target_group_comment']);
         }
     }
     return $activity;
 }