function save()
 {
     $team = new stdClass();
     $team->id = $_POST['id'];
     $team->name = $_POST['name'];
     $team->short_name = $_POST['short_name'];
     $team->season_id = $_POST['season'];
     $team->club_id = $_POST['club'];
     $db = new KKL_DB();
     $team = $db->createOrUpdateTeam($team);
     $properties = array();
     $properties['location'] = false;
     $properties['current_league_winner'] = false;
     $properties['current_cup_winner'] = false;
     if ($_POST['location']) {
         $properties['location'] = $_POST['location'];
     }
     if ($_POST['current_league_winner']) {
         $properties['current_league_winner'] = "true";
     }
     if ($_POST['current_cup_winner']) {
         $properties['current_cup_winner'] = "true";
     }
     if (!empty($properties)) {
         $db->setTeamProperties($team, $properties);
     }
     return $db->getTeam($team->id);
 }