@Override
  public void saveEmailConfiguration(EmailConfig emailConfig, MerchantStore store)
      throws ServiceException {
    MerchantConfiguration configuration =
        merchantConfigurationService.getMerchantConfiguration(Constants.EMAIL_CONFIG, store);
    if (configuration == null) {
      configuration = new MerchantConfiguration();
      configuration.setMerchantStore(store);
      configuration.setKey(Constants.EMAIL_CONFIG);
    }

    String value = emailConfig.toJSONString();
    configuration.setValue(value);
    merchantConfigurationService.saveOrUpdate(configuration);
  }
  @Override
  public EmailConfig getEmailConfiguration(MerchantStore store) throws ServiceException {

    MerchantConfiguration configuration =
        merchantConfigurationService.getMerchantConfiguration(Constants.EMAIL_CONFIG, store);
    EmailConfig emailConfig = null;
    if (configuration != null) {
      String value = configuration.getValue();

      ObjectMapper mapper = new ObjectMapper();
      try {
        emailConfig = mapper.readValue(value, EmailConfig.class);
      } catch (Exception e) {
        throw new ServiceException("Cannot parse json string " + value);
      }
    }
    return emailConfig;
  }