/**
  * @param Branch $branch
  * @return bool
  */
 public function isDefault($branch)
 {
     if (!$branch instanceof Branch) {
         return false;
     }
     $defaultBranchId = $this->systemSettings->getDefaultBranchId();
     if (!$defaultBranchId || is_null($branch->getId())) {
         return false;
     }
     return $defaultBranchId == $branch->getId();
 }
 /**
  * @param $from
  * @param $to
  * @return int
  */
 private function getAppropriateBranch($from, $to)
 {
     $branchId = null;
     preg_match('/@(.*)/', $from, $output);
     if (isset($output[1])) {
         $customerDomain = $output[1];
         $branchId = $this->branchEmailConfigurationService->getConfigurationBySupportAddressAndCustomerDomain($to, $customerDomain);
     }
     if (!$branchId) {
         $branchId = $this->emailProcessingSettings->getDefaultBranchId();
     }
     return $branchId;
 }