private function addUserToRecordSet(Gpf_Data_RecordSet $result, $userId) { $user = new Pap_Affiliates_User(); $user->setId($userId); try { $user->load(); $record = $result->createRecord(); $record->loadFromObject(array_values($user->toArray())); $record->set("subaffiliates", 1); $result->add($record); if (strlen($user->getParentUserId())) { $this->addUserToRecordSet($result, $user->getParentUserId()); } } catch (Exception $e) { } }