@Override
 public String save(
     HttpServletRequest request,
     @ModelAttribute("modelObject") Invoice entity,
     BindingResult bindingResult,
     ModelMap model) {
   // TODO Auto-generated method stub
   if (entity.getTransferStation() == null) {
     bindingResult.rejectValue("transferStation", "error.select.option", null, null);
   }
   if (entity.getLandfill() == null) {
     bindingResult.rejectValue("landfill", "error.select.option", null, null);
   }
   // validate entity
   try {
     getValidator().validate(entity, bindingResult);
   } catch (ValidationException e) {
     e.printStackTrace();
     log.warn("Error in validation :" + e);
   }
   // return to form if we had errors
   if (bindingResult.hasErrors()) {
     setupCreate(model, request);
     return urlContext + "/form";
   }
   String path = Configuration.getProperty("storage.folder.repository") + "/" + "invoice";
   CommonsMultipartFile file = entity.getInvoiceFile();
   String invoicefileName = file.getOriginalFilename();
   File folderpath = new File(path);
   try {
     if (!folderpath.exists()) {
       folderpath.mkdirs();
     }
     String fullpath = path + "/" + invoicefileName;
     System.out.println(fullpath);
     File invoicefile = new File(fullpath);
     if (!invoicefile.exists()) {
       invoicefile.createNewFile();
     }
     file.transferTo(invoicefile);
     entity.setFilePath(fullpath);
     beforeSave(request, entity, model);
     // merge into datasource
     genericDAO.saveOrUpdate(entity);
     cleanUp(request);
   } catch (IOException e) {
     e.printStackTrace();
   }
   return "redirect:list.do";
 }