@PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
  @RequestMapping(value = "/{filterId}", method = RequestMethod.PUT)
  public @ResponseBody Filter updateFilter(
      @PathVariable String boardId, @PathVariable String filterId, @RequestBody Filter filter)
      throws Exception {

    if (filter.getPath() == null) {
      filter.setPath(String.format(URI.FILTER_URI, boardId, filterId));
    }

    ObjectContentManager ocm = ocmFactory.getOcm();
    try {
      ocm.update(filter);
      ocm.save();
      this.cacheInvalidationManager.invalidate(BoardController.BOARD, boardId);
    } finally {
      ocm.logout();
    }

    return filter;
  }
  @PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
  @RequestMapping(value = "", method = RequestMethod.POST)
  public @ResponseBody Filter createFilter(@PathVariable String boardId, @RequestBody Filter filter)
      throws Exception {
    if (filter.getPath() != null) {
      logger.warn("Attempt to update filter using POST");
      throw new Exception("Attempt to Update Filter using POST. Use PUT instead");
    }

    ObjectContentManager ocm = ocmFactory.getOcm();
    try {
      listTools.ensurePresence(String.format(URI.BOARD_URI, boardId), "filters", ocm.getSession());
      String newId = IdentifierTools.getIdFromNamedModelClass(filter);
      filter.setPath(String.format(URI.FILTER_URI, boardId, newId.toString()));
      ocm.insert(filter);
      ocm.save();
      this.cacheInvalidationManager.invalidate(BoardController.BOARD, boardId);
    } finally {
      ocm.logout();
    }
    return filter;
  }