/**
  * Note: Currently we have no way of flagging which user is the account owner.
  * We just rely on the behavior that the first user added to an institution,
  * which as a rule IS set to be the account owner, will be returned by doctrine
  * ArrayCollection->first(). (This observation has yet to be fully confirmed)
  *
  * @param mixed $institution Either institution id or an instance of Institution
  * @return InstitutionUser
  */
 public function getAccountOwner($institution)
 {
     if (is_numeric($institution)) {
         $institution = $this->doctrine->getRepository('InstitutionBundle:Institution')->find($institution);
     }
     if (!$institution instanceof Institution) {
         throw new \Exception('Invalid institution');
     }
     //FIXME: getAccountData returns null
     return $this->institutionUserService->getAccountData($institution->getInstitutionUsers()->first());
     //return $this->institutionUserService->getAccountDataById($institution->getInstitutionUsers()->first()->getAccountId());
 }
 public function createInstitutionUser(InstitutionUserType $institutionUserType, InstitutionUser $institutionUser)
 {
     $institutionUser->setInstitutionUserType($institutionUserType);
     $institutionUser = $this->institutionUserService->create($institutionUser);
 }