@PUT
    @Path("{id}")
    @ApiOperation("Update view")
    @AuditEvent(type = ViewsAuditEventTypes.VIEW_UPDATE)
    public ViewDTO update(@ApiParam(name = "id") @PathParam("id") @NotEmpty String id,
                          @ApiParam @Valid ViewDTO dto,
                          @Context SearchUser searchUser) {
        final ViewDTO updatedDTO = dto.toBuilder().id(id).build();
        if (!searchUser.canUpdateView(updatedDTO)) {
            throw new ForbiddenException("Not allowed to edit " + summarize(updatedDTO) + ".");
        }

        validateIntegrity(updatedDTO, searchUser, false);

        var result = dbService.update(updatedDTO);
        recentActivityService.update(result.id(), result.type().equals(ViewDTO.Type.DASHBOARD) ? GRNTypes.DASHBOARD : GRNTypes.SEARCH, searchUser);
        return result;
    }
@Test
    public void updatesSearchSuccessfullyIfInvisibleFilterWasPresentBefore() {
        final ViewService viewService = mockViewService(TEST_SEARCH_VIEW);
        final var dto = ViewDTO.builder().searchId("1").title("2").state(new HashMap<>()).build();
        when(viewService.update(any())).thenReturn(dto);

        final ViewsResource viewsResource = createViewsResource(
                viewService,
                mock(StartPageService.class),
                mock(RecentActivityService.class),
                mock(ClusterEventBus.class),
                referencedFiltersHelperWithIDs(Collections.singleton("<<Hidden filter, but not added by this update>>")),
                searchFilterVisibilityChecker(Collections.singletonList("<<Hidden filter, but not added by this update>>")),
                EMPTY_VIEW_RESOLVERS,
                SEARCH
        );

        viewsResource.update(VIEW_ID, TEST_SEARCH_VIEW, SEARCH_USER);
        verify(viewService).update(TEST_SEARCH_VIEW);
    }