/**
   * @param id
   * @return
   */
  @BodyParser.Of(BodyParser.Json.class)
  public static Result update(Long id) {
    if (id == null) {
      return badRequest(Messages.get("id.expecting"));
    }

    JsonNode jsonNode = request().body().asJson();
    if (jsonNode == null) {
      return badRequest(Messages.get("json.expecting"));
    }
    Customer customer = Json.fromJson(jsonNode, Customer.class);
    if (customer == null) {
      return badRequest(Messages.get("json.expecting"));
    }
    customer.id = id;
    customer.update();
    return ok();
  }
  public static Result update_save(Long id) {
    Form<CustomerForm> filledForm = customerForm.bindFromRequest();

    if (filledForm.hasErrors()) {
      return badRequest(update.render(filledForm, id));
    }

    CustomerForm customerForm = filledForm.get();
    if (customerForm == null) {
      return badRequest(update.render(filledForm, id));
    }

    Customer customer = Customer.get(id);

    if (customer == null) {
      filledForm.reject(Messages.get("id.not.exists", id));
      return badRequest(update.render(filledForm, id));
    }

    formToModel(customer, customerForm);
    customer.update();

    return redirect(controllers.routes.CustomerController.index());
  }