/** * @param Account $account * @return bool */ function SaveMailingList($account) { if ($account && $account->IsMailList) { if ($this->_connector->Execute($this->_commandCreator->ClearMailingList($account->Id))) { $return = true; if (is_array($account->MailingList) && count($account->MailingList) > 0) { $mailinglist = array_unique($account->MailingList); foreach ($mailinglist as $mailingListItem) { $return &= $this->_connector->Execute($this->_commandCreator->InsertMailingListItem($account->Id, $account->Email, $mailingListItem)); } } return $return; } return false; } return true; }