/**
  * Check account outside fund and create new if does not exist
  *
  * @param ClientAccount $account
  * @param SecurityAssignment $securityAssignment
  * @param bool $isPreferred
  * @return mixed|void
  * @throws \Wealthbot\AdminBundle\Exception\DataAlreadyExistsException
  */
 protected function checkAccountAssociation(ClientAccount $account, SecurityAssignment $securityAssignment, $isPreferred)
 {
     if ($this->existAccountAssociation($account->getId(), $securityAssignment->getId())) {
         throw new DataAlreadyExistsException(sprintf("SecurityAssignment with id: %s already exist for client account with id: %s", $securityAssignment->getId(), $account->getId()));
     }
     $this->createAccountAssociation($account, $securityAssignment, $isPreferred);
 }
 /**
  * Check if account outside fund exist and create new if it does not exist
  *
  * @param ClientAccount $account
  * @param SecurityAssignment $securityAssignment
  * @param $isPreferred
  * @return mixed|null|AccountOutsideFund
  */
 protected function checkAccountAssociation(ClientAccount $account, SecurityAssignment $securityAssignment, $isPreferred)
 {
     $association = $this->existAccountAssociation($account->getId(), $securityAssignment->getId());
     if (!$association) {
         $association = $this->createAccountAssociation($account, $securityAssignment, $isPreferred);
     } else {
         $this->updateAccountAssociation($association, $isPreferred);
     }
     return $association;
 }