class WorkspaceResource extends TransactionalResource {

    @Timed
    @Path("loadWorkspace")
    @POST
    public String loadWorkspace(@Auth AuthorizedPrincipal principal,
                                @Context HttpServletRequest request,
                                InputStream requestBody,
                                @Context DSLContext create) {
        return mutate(principal, model -> {
            Agency p = model.getCurrentPrincipal()
                            .getPrincipal();
            WorkspaceSnapshot snapshot;
            try {
                snapshot = objectMapper.readValue(requestBody,
                                                  WorkspaceSnapshot.class);
            } catch (IOException e) {
                log.info(String.format("Failed deserializing workspace snapshot by: %s:%s",
                                       p.getName(), p.getId()),
                         e);
                throw new WebApplicationException(String.format("Failed deserializing workspace: %s",
                                                                e.getMessage()),
                                                  Status.BAD_REQUEST);
            }

            try {
                snapshot.load(create);
            } catch (Exception e) {
                log.info(String.format("Failed loading workspace snapshot by: %s:%s",
                                       p.getName(), p.getId()),
                         e);
                throw new WebApplicationException(String.format("Cannot load workspace: %s",
                                                                e.getMessage()),
                                                  Status.BAD_REQUEST);
            }
            Product definingProduct = snapshot.getDefiningProduct();

            Workspace workspace = model.wrap(Workspace.class, definingProduct);
            return workspace.get_Properties()
                            .getIri();
        }, create);
    }

    public  WorkspaceResource();
    public  WorkspaceResource(URLClassLoader executionScope);

}