/** * @param $data * @param $url * @param $resume * @param $filename * @return \SimpleXMLElement */ public function execute($data, $url, $resume, $filename) { $transaction = $this->client->beginTrans(); $transaction->post('/candidate/', $this->prepareCandidate($data)); foreach ($this->prepareExperiences($data) as $index => $experience) { // avoid "too many employment items error" if ($index == 3) { break; } $transaction->post('/candidate/queued/employment/', $experience); } $transaction->post('/candidate/queued/attachment/', array('fileName' => $filename, 'base64stream' => $resume, 'type' => 1)); $result = $transaction->commit(); return $result; }