/**
  * Deletes a apartment
  *
  * @param string $id
  */
 public function deleteAction($id)
 {
     $apartment = Apartment::findFirstByid($id);
     if (!$apartment) {
         $this->flash->error("apartment was not found");
         return $this->dispatcher->forward(array("controller" => "apartment", "action" => "index"));
     }
     if (!$apartment->delete()) {
         foreach ($apartment->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "apartment", "action" => "search"));
     }
     $this->flash->success("apartment was deleted successfully");
     return $this->dispatcher->forward(array("controller" => "apartment", "action" => "index"));
 }