@RequestMapping(value = "/key/{keyId}/delete", method = RequestMethod.GET)
  public ModelAndView deleteKeyForGroup(@PathVariable("keyId") final String keyId) {
    final DeployKey key = this.service.deleteDeployKey(keyId);

    if (key != null && key.getGroup().getId() != null) {
      return new ModelAndView(
          "redirect:/deploy/auth/group/"
              + urlPathSegmentEscaper().escape(key.getGroup().getId())
              + "/view");
    } else {
      return new ModelAndView("redirect:/deploy/auth/key");
    }
  }
  @RequestMapping(value = "/key/{keyId}/edit", method = RequestMethod.POST)
  public ModelAndView editKeyPost(
      @PathVariable("keyId") final String keyId,
      @Valid @FormData("command") final DeployKeyBean key,
      final BindingResult result) {
    if (!result.hasErrors()) {
      final DeployKey dk = this.service.updateDeployKey(keyId, key.getName());
      if (dk != null && dk.getGroup().getId() != null) {
        return new ModelAndView(
            "redirect:/deploy/auth/group/"
                + urlPathSegmentEscaper().escape(dk.getGroup().getId())
                + "/view");
      }
    }

    return new ModelAndView("editKey", Collections.singletonMap("command", key));
  }