@Override
  public String processPostCreate(Map<String, Object> requestParams) {
    Integer idExhibition = Integer.parseInt((String) requestParams.get("id_exhibition"));
    String chairNum = (String) requestParams.get("chair_num");
    String email = (String) requestParams.get("email");
    String password = (String) requestParams.get("password");
    String strPurchaseLocation = (String) requestParams.get("purchase_location");

    PurchaseLocation purchaseLocation;
    if (strPurchaseLocation.equals("local")) {
      purchaseLocation = PurchaseLocation.LOCAL;
    } else if (strPurchaseLocation.equals("internet")) {
      purchaseLocation = PurchaseLocation.INTERNET;
    } else {
      LOGGER.warn("Invalid purchase location value '" + strPurchaseLocation + "'");
      return createErrorJSONResponse(
          "Invalid purchase location value '" + strPurchaseLocation + "'");
    }

    String strSendMail = (String) requestParams.get("send_mail");
    boolean sendMail = false;
    if (strSendMail != null
        && strSendMail.equals("true")
        && purchaseLocation == PurchaseLocation.INTERNET) {
      sendMail = true;
    }

    try {
      User user = new User();
      user.setEmail(email);
      user.setPassword(password);

      User foundUser = userService.checkLogin(user);
      if (foundUser != null) {
        Exhibition exhibition = exhibitionService.find(idExhibition);

        Ticket ticket = new Ticket(exhibition, chairNum, foundUser, purchaseLocation, new Date());
        ticketService.create(ticket);

        String objectJSON = new Gson().toJson(ticket);
        JsonObject responseJson = new JsonObject();
        responseJson.addProperty("success", true);
        responseJson.addProperty("ticket", objectJSON);
        return responseJson.toString();
      } else {
        LOGGER.warn("Invalid authentication info");
        return createErrorJSONResponse("Invalid authentication info");
      }
    } catch (ServiceException e) {
      LOGGER.warn(e.getMessage());
      return createErrorJSONResponse(e.getMessage());
    } catch (DaoException e) {
      LOGGER.error(e.getMessage(), e);
      return createErrorJSONResponse(e.getMessage());
    } catch (InterruptedException e) {
      LOGGER.error("Error on saving changes on database", e);
      return createErrorJSONResponse("Error on saving changes on database");
    }
  }
  @Override
  public String processPostDelete(Map<String, Object> requestParams) {
    String token = (String) requestParams.get("token");
    User user = new User();
    try {
      user.setEmail((String) requestParams.get("email"));
      user.setPassword((String) requestParams.get("password"));
      ticketService.delete(token, user);

      JsonObject responseJson = new JsonObject();
      responseJson.addProperty("success", true);
      responseJson.addProperty("token", token);
      return responseJson.toString();
    } catch (ServiceException e) {
      LOGGER.warn(e.getMessage());
      return createErrorJSONResponse(e.getMessage());
    } catch (DaoException e) {
      LOGGER.error(e.getMessage(), e);
      return createErrorJSONResponse(e.getMessage());
    }
  }