class DocumentResource {

    @POST
    @Path("/bulk")
    public Response saveDocuments(@PathParam("table") final String table, @Valid final List<Document> document) {
        try {
            queryStore.save(table, document);
        } catch (QueryStoreException ex) {
            logger.error("Save error: ", ex);
            switch (ex.getErrorCode()) {
                case NO_SUCH_TABLE:
                case INVALID_REQUEST:
                    return Response.status(Response.Status.BAD_REQUEST)
                            .entity(Collections.singletonMap("error", ex.getErrorCode()))
                            .build();
                case DOCUMENT_SAVE_ERROR:
                default:
                    return Response.serverError()
                            .entity(Collections.singletonMap("error", ex.getErrorCode()))
                            .build();

            }
        }
        return Response.created(URI.create("/" + table)).build();
    }

    public  DocumentResource(QueryStore queryStore);

}