public function processFaxes($contact, $faxes)
{
$get = function ($fax) {
return $fax->getId();
};
$delete = function ($fax) use($contact) {
$contact->removeFax($fax);
return true;
};
$update = function ($fax, $matchedEntry) {
return $this->updateFax($fax, $matchedEntry);
};
$add = function ($fax) use($contact) {
$this->addFax($contact, $fax);
return true;
};
$entities = $contact->getFaxes();
$result = $this->processSubEntities($entities, $faxes, $get, $add, $update, $delete);
$this->resetIndexOfSubentites($entities);
// check main
$this->setMainFax($contact);
return $result;
}