public function updateContact($user, $recipientId, $oldEmail)
 {
     $optParams = array('OLD_EMAIL' => $oldEmail);
     $this->createConnection();
     $updatedContact = array('Email' => $user['User']['email'], '_newswire_subscription' => $user['User']['email_notify_for_site'] ? 'Yes' : 'No', '_user_id' => $user['User']['id'], 'first_name' => $this->prepareForXml($user['User']['first_name']), 'last_name' => $this->prepareForXml($user['User']['last_name']));
     SilverpopConnector::getInstance()->updateRecipient(SILVERPOP_CTV_DB, $recipientId, $updatedContact, $optParams);
 }
function getJobStatusLoop($jobId, $numAttempts = 600)
{
    $isCompleted = false;
    $attempts = 0;
    $response = null;
    //sleep(300); // Sleep for the first five minutes no matter what.
    while (!$isCompleted && $attempts < $numAttempts) {
        $jobStatus = SilverpopConnector::getInstance()->getJobStatus($jobId);
        switch ($jobStatus) {
            case "COMPLETE":
                $isCompleted = true;
                break;
            case "RUNNING":
            case "WAITING":
                // Give the job time to complete.
                sleep(60);
                break;
            case "CANCELED":
                //yes Silverpop spelled this wrong.
            //yes Silverpop spelled this wrong.
            case "ERROR":
            default:
                $response = "\nError: Silverpop get job status execution failed. Attempts: {$attempts} ";
                exit(-1);
                break;
        }
        // Increment the attempts; limit attempts.
        $attempts++;
    }
    if ($isCompleted === false) {
        //$isCompleted = $response;
        $response .= "\nNot completed. {$attempts} attempts. ";
    } else {
        $response .= "\nJob successfully completed. {$attempts} attempts. ";
    }
    //return $isCompleted;
    return $response;
}