protected PagedListHolder<DeliveryMethodViewBean> initList(
      final HttpServletRequest request, String sessionKey, final RequestData requestData)
      throws Exception {
    final MarketArea marketArea = requestData.getMarketArea();

    PagedListHolder<DeliveryMethodViewBean> deliveryMethodViewBeanPagedListHolder =
        new PagedListHolder<DeliveryMethodViewBean>();

    final List<DeliveryMethodViewBean> deliveryMethodViewBeans =
        new ArrayList<DeliveryMethodViewBean>();

    final List<DeliveryMethod> deliveryMethods =
        deliveryMethodService.findDeliveryMethodsByMarketAreaId(marketArea.getId());
    for (Iterator<DeliveryMethod> iterator = deliveryMethods.iterator(); iterator.hasNext(); ) {
      DeliveryMethod deliveryMethod = (DeliveryMethod) iterator.next();
      deliveryMethodViewBeans.add(
          backofficeViewBeanFactory.buildViewBeanDeliveryMethod(
              requestUtil.getRequestData(request), deliveryMethod));
    }
    deliveryMethodViewBeanPagedListHolder =
        new PagedListHolder<DeliveryMethodViewBean>(deliveryMethodViewBeans);
    deliveryMethodViewBeanPagedListHolder.setPageSize(Constants.PAGE_SIZE);
    request.getSession().setAttribute(sessionKey, deliveryMethodViewBeanPagedListHolder);

    return deliveryMethodViewBeanPagedListHolder;
  }
  @RequestMapping(value = BoUrls.DELIVERY_METHOD_EDIT_URL, method = RequestMethod.POST)
  public ModelAndView submitDeliveryMethodEdit(
      final HttpServletRequest request,
      final Model model,
      @Valid @ModelAttribute(ModelConstants.DELIVERY_METHOD_FORM)
          DeliveryMethodForm deliveryMethodForm,
      BindingResult result)
      throws Exception {
    final RequestData requestData = requestUtil.getRequestData(request);
    final Locale locale = requestData.getLocale();

    if (result.hasErrors()) {
      return deliveryMethodEdit(request, model, deliveryMethodForm);
    }

    DeliveryMethod deliveryMethod = null;
    if (StringUtils.isNotEmpty(deliveryMethodForm.getId())) {
      deliveryMethod = deliveryMethodService.getDeliveryMethodById(deliveryMethodForm.getId());
    }

    try {
      // CREATE OR UPDATE DELIVERY METHOD
      DeliveryMethod savedDeliveryMethod =
          webBackofficeService.createOrUpdateDeliveryMethod(deliveryMethod, deliveryMethodForm);

      if (deliveryMethod == null) {
        addSuccessMessage(
            request,
            getSpecificMessage(ScopeWebMessage.DELIVERY_METHOD, "create_success_message", locale));
      } else {
        addSuccessMessage(
            request,
            getSpecificMessage(ScopeWebMessage.DELIVERY_METHOD, "update_success_message", locale));
      }
      final String urlRedirect =
          backofficeUrlService.generateUrl(
              BoUrls.DELIVERY_METHOD_DETAILS,
              requestUtil.getRequestData(request),
              savedDeliveryMethod);
      return new ModelAndView(new RedirectView(urlRedirect));

    } catch (Exception e) {
      addMessageError(
          result,
          null,
          "code",
          "code",
          getSpecificMessage(ScopeWebMessage.DELIVERY_METHOD, "create_or_update_message", locale));
      logger.error(
          "Can't save or update Delivery Method:"
              + deliveryMethodForm.getId()
              + "/"
              + deliveryMethodForm.getCode(),
          e);
      return deliveryMethodEdit(request, model, deliveryMethodForm);
    }
  }
  @RequestMapping(value = BoUrls.DELIVERY_METHOD_DETAILS_URL, method = RequestMethod.GET)
  public ModelAndView deliveryMethodDetails(final HttpServletRequest request, final Model model)
      throws Exception {
    ModelAndViewThemeDevice modelAndView =
        new ModelAndViewThemeDevice(
            getCurrentVelocityPath(request), BoUrls.DELIVERY_METHOD_DETAILS.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);

    final String deliveryMethodCode =
        request.getParameter(RequestConstants.REQUEST_PARAMETER_DELIVERY_METHOD_CODE);

    // SANITY CHECK
    if (StringUtils.isEmpty(deliveryMethodCode)) {
      final String urlRedirect =
          backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_LIST, requestData);
      return new ModelAndView(new RedirectView(urlRedirect));
    }

    final DeliveryMethod deliveryMethod =
        deliveryMethodService.getDeliveryMethodByCode(deliveryMethodCode);

    // SANITY CHECK
    if (deliveryMethod != null) {
      modelAndView.addObject(
          ModelConstants.DELIVERY_METHOD_VIEW_BEAN,
          backofficeViewBeanFactory.buildViewBeanDeliveryMethod(requestData, deliveryMethod));
    } else {
      final String url = requestUtil.getLastRequestUrl(request);
      return new ModelAndView(new RedirectView(url));
    }

    final List<WarehouseViewBean> warehouseViewBeans = new ArrayList<WarehouseViewBean>();
    final List<Warehouse> warehouses =
        warehouseService.findWarehousesByDeliveryMethodId(deliveryMethod.getId());
    for (Iterator<Warehouse> iterator = warehouses.iterator(); iterator.hasNext(); ) {
      Warehouse warehouse = (Warehouse) iterator.next();
      warehouseViewBeans.add(
          backofficeViewBeanFactory.buildViewBeanWarehouse(
              requestUtil.getRequestData(request), warehouse));
    }
    request.setAttribute(ModelConstants.WAREHOUSES_VIEW_BEAN, warehouseViewBeans);

    model.addAttribute(
        ModelConstants.URL_BACK,
        backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_LIST, requestData));

    Object[] params = {deliveryMethod.getName() + " (" + deliveryMethod.getCode() + ")"};
    initPageTitleAndMainContentTitle(
        request, modelAndView, BoUrls.DELIVERY_METHOD_DETAILS.getKey(), params);

    return modelAndView;
  }
  @ModelAttribute(ModelConstants.DELIVERY_METHOD_FORM)
  protected DeliveryMethodForm initDeliveryMethodForm(
      final HttpServletRequest request, final Model model) throws Exception {
    final RequestData requestData = requestUtil.getRequestData(request);

    final String deliveryMethodCode =
        request.getParameter(RequestConstants.REQUEST_PARAMETER_DELIVERY_METHOD_CODE);
    if (StringUtils.isNotEmpty(deliveryMethodCode)) {
      final DeliveryMethod deliveryMethodEdit =
          deliveryMethodService.getDeliveryMethodByCode(deliveryMethodCode);
      return backofficeFormFactory.buildDeliveryMethodForm(requestData, deliveryMethodEdit);
    }

    return backofficeFormFactory.buildDeliveryMethodForm(requestData, null);
  }
  @RequestMapping(value = BoUrls.DELIVERY_METHOD_EDIT_URL, method = RequestMethod.GET)
  public ModelAndView deliveryMethodEdit(
      final HttpServletRequest request,
      final Model model,
      @ModelAttribute(ModelConstants.DELIVERY_METHOD_FORM) DeliveryMethodForm deliveryMethodForm)
      throws Exception {
    ModelAndViewThemeDevice modelAndView =
        new ModelAndViewThemeDevice(
            getCurrentVelocityPath(request), BoUrls.DELIVERY_METHOD_EDIT.getVelocityPage());
    final RequestData requestData = requestUtil.getRequestData(request);

    final String deliveryMethodCode =
        request.getParameter(RequestConstants.REQUEST_PARAMETER_DELIVERY_METHOD_CODE);
    if (StringUtils.isNotEmpty(deliveryMethodCode)) {
      // EDIT MODE
      final DeliveryMethod deliveryMethod =
          deliveryMethodService.getDeliveryMethodByCode(
              deliveryMethodCode, FetchPlanGraphDeliveryMethod.fullDeliveryMethodFetchPlan());

      DeliveryMethodViewBean deliveryMethodViewBean =
          backofficeViewBeanFactory.buildViewBeanDeliveryMethod(requestData, deliveryMethod);
      request.setAttribute(ModelConstants.DELIVERY_METHOD_VIEW_BEAN, deliveryMethodViewBean);

      Object[] params = {deliveryMethod.getName() + " (" + deliveryMethod.getCode() + ")"};
      initPageTitleAndMainContentTitle(
          request, modelAndView, BoUrls.DELIVERY_METHOD_EDIT.getKey(), params);

      model.addAttribute(
          ModelConstants.URL_BACK,
          backofficeUrlService.generateUrl(
              BoUrls.DELIVERY_METHOD_DETAILS, requestData, deliveryMethod));
    } else {
      // ADD MODE

      initPageTitleAndMainContentTitle(
          request, modelAndView, BoUrls.DELIVERY_METHOD_ADD.getKey(), null);

      model.addAttribute(
          ModelConstants.URL_BACK,
          backofficeUrlService.generateUrl(BoUrls.DELIVERY_METHOD_LIST, requestData));
    }

    return modelAndView;
  }