/**
  * @param Organization              $organization
  * @param UpdateOrganizationRequest $request
  */
 private function handleRequest($organization, $request)
 {
     $organization->setName($request->name())->setDescription($request->description());
     $mainAddress = $organization->addressById($request->addressId());
     if ($mainAddress) {
         $mainAddress->setLine1($request->line1())->setZipPostCode($request->zipPostCode())->setNumber($request->number())->setFloor($request->floor())->setDoor($request->door());
     } else {
         $organization->addAddress($this->buildAddress($request));
     }
 }
 /**
  * @param Organization $organization
  *
  * @return OrganizationFileResource
  */
 private function buildOrganizationResource(Organization $organization)
 {
     return new OrganizationFileResource($organization->id(), $organization->name(), $organization->description(), $this->buildOrganizationFileAddressResource($organization->addresses()));
 }
 public function __construct(Identity $identity, $name, $description, $address = null)
 {
     parent::__construct($identity, $name, $description, $address);
 }
 /**
  * @param Organization $organization
  *
  * @return OrganizationForListResource
  */
 private function buildOrganizationResource(Organization $organization)
 {
     return new OrganizationForListResource($organization->id(), $organization->name(), $organization->creationDate());
 }