/**
  * @param IOffice $office
  * @return void
  */
 public function addOffice(IOffice $office)
 {
     $new_order = 0;
     $offices = $this->getOffices();
     if (count($offices) > 0) {
         $last_one = end($offices);
         $new_order = $last_one->getOrder() + 1;
     }
     $office->setOrder($new_order);
     $query = new QueryObject(new Office());
     $query->addOrder(QueryOrder::asc('Order'));
     AssociationFactory::getInstance()->getOne2ManyAssociation($this, 'Offices', $query)->add($office);
 }
 public static function convertOfficeToArray(IOffice $office)
 {
     $res = array();
     $res['address_1'] = $office->getAddress();
     $res['address_2'] = $office->getAddress1();
     $res['city'] = $office->getCity();
     $res['state'] = $office->getState();
     $res['zip_code'] = $office->getZipCode();
     $res['country'] = $office->getCountry();
     return $res;
 }