@ExceptionHandler(Exception.class)
 public @ResponseBody ModelAndView exceptionHandler(Exception ex) {
   Response response = new Response();
   response.setError(500, ex.getMessage());
   log.error("Response: " + response.toString());
   return mav().addObject(Const.responseKey, response);
 }
  public Response validateAndSaveEntity(Entity entity, BaseService service) {
    Response response = serverResponse();
    try {
      Validity vsEntity = service.validate(entity);
      if (vsEntity.isValid()) {
        service.insert(entity);
        response.setResult(entity);
      } else {
        response.setError(key.vdnCode, vsEntity.errors());
      }
    } catch (Exception e) {
      log.error(e.getMessage());
      response.setError(key.iseCode, e.getMessage());
    }

    return response;
  }