protected function getInvitationCode()
{
// Generate a new invitation code.
$Code = BetterRandomString(16, 'Aa0');
// Make sure the string doesn't already exist in the invitation table
$CodeData = $this->getWhere(array('Code' => $Code));
if ($CodeData->numRows() > 0) {
return $this->GetInvitationCode();
} else {
return $Code;
}
}