@RequestMapping(value = "/admin/options/save.html", method = RequestMethod.POST)
  public String saveOption(
      @Valid @ModelAttribute("option") ProductOption option,
      BindingResult result,
      Model model,
      HttpServletRequest request)
      throws Exception {

    // display menu
    setMenu(model, request);

    MerchantStore store = (MerchantStore) request.getAttribute("MERCHANT_STORE");
    ProductOption dbEntity = null;

    if (option.getId() != null && option.getId() > 0) { // edit entry

      // get from DB
      dbEntity = productOptionService.getById(store, option.getId());

      if (dbEntity == null) {
        return "redirect:/admin/options/options.html";
      }
    }

    Map<String, Language> langs = languageService.getLanguagesMap();

    List<ProductOptionDescription> descriptions = option.getDescriptionsList();

    if (descriptions != null) {

      for (ProductOptionDescription description : descriptions) {

        String code = description.getLanguage().getCode();
        Language l = langs.get(code);
        description.setLanguage(l);
        description.setProductOption(option);
      }
    }

    option.setDescriptions(new HashSet<ProductOptionDescription>(descriptions));
    option.setMerchantSore(store);

    if (result.hasErrors()) {
      return "catalogue-options-details";
    }

    productOptionService.saveOrUpdate(option);

    model.addAttribute("success", "success");
    return "catalogue-options-details";
  }
  private String displayOption(
      Long optionId,
      HttpServletRequest request,
      HttpServletResponse response,
      Model model,
      Locale locale)
      throws Exception {

    this.setMenu(model, request);
    MerchantStore store = (MerchantStore) request.getAttribute("MERCHANT_STORE");

    List<Language> languages = store.getLanguages();

    Set<ProductOptionDescription> descriptions = new HashSet<ProductOptionDescription>();

    ProductOption option = new ProductOption();

    if (optionId != null && optionId != 0) { // edit mode

      option = productOptionService.getById(store, optionId);

      if (option == null) {
        return "redirect:/admin/options/options.html";
      }

      Set<ProductOptionDescription> optionDescriptions = option.getDescriptions();

      for (Language l : languages) {

        ProductOptionDescription optionDescription = null;

        if (optionDescriptions != null) {

          for (ProductOptionDescription description : optionDescriptions) {

            String code = description.getLanguage().getCode();
            if (code.equals(l.getCode())) {
              optionDescription = description;
            }
          }
        }

        if (optionDescription == null) {
          optionDescription = new ProductOptionDescription();
          optionDescription.setLanguage(l);
        }

        descriptions.add(optionDescription);
      }

    } else {

      for (Language l : languages) {

        ProductOptionDescription desc = new ProductOptionDescription();
        desc.setLanguage(l);
        descriptions.add(desc);
      }
    }

    option.setDescriptions(descriptions);
    model.addAttribute("option", option);
    return "catalogue-options-details";
  }