public function save ($uri, $to, $type, $siteId = null, $id = null)
	{
		if ($siteId === 'null')
			$siteId = null;

		if ($id)
		{
			$record = RedirectRecord::findOne(compact('id'));

			if (!$record)
				return 'Unable to find redirect with ID: ' . $id;
		}
		else
		{
			$existing = RedirectRecord::findOne(compact('uri', 'siteId'));

			if ($existing)
				return 'A redirect with that URI already exists!';

			$record = new RedirectRecord();
		}

		$record->uri    = $uri;
		$record->to     = $to;
		$record->type   = $type;
		if ($siteId !== false)
			$record->siteId = $siteId;

		if (!$record->save())
			return $record->getErrors();

		return $record->id;
	}