function registerMatch($serverLogin, Match $match, $scriptName, $titleIdString, $lobbyLogin)
	{
		$this->db->execute('BEGIN');
		try
		{
			$this->db->execute(
				'INSERT INTO Matches (creationDate, state, matchServerLogin, scriptName, titleIdString, lobbyLogin) '.
				'VALUES (NOW(), -1, %s, %s, %s, %s)',
				$this->db->quote($serverLogin),
				$this->db->quote($scriptName),
				$this->db->quote($titleIdString),
				$this->db->quote($lobbyLogin)
			);
			$matchId = $this->db->insertID();

			$this->updateServerCurrentMatchId($matchId, $serverLogin, $scriptName, $titleIdString);

			foreach($match->players as $player)
			{
				$this->addMatchPlayer($matchId, $player, $match->getTeam($player));
			}
			$this->db->execute('COMMIT');
		}
		catch(\Exception $e)
		{
			$this->db->execute('ROLLBACK');
			throw $e;
		}

		return $matchId;
	}