/**
  * @param Company       $company
  * @param CompanyEntity $companyEntity
  *
  * @return CompanyEntity
  */
 public static function toEntity(Company $company, CompanyEntity $companyEntity)
 {
     $companyEntity->setId($company->id());
     $companyEntity->setName($company->getName());
     $companyEntity->setMainActivity($company->mainActivity()->code());
     $companyEntity->setLegalCode($company->getLegalCode());
     if ($company->users()) {
         foreach ($company->users() as $user) {
             $companyEntity->addUser($user);
         }
     }
     return $companyEntity;
 }