class CatalogRest {

    @POST
    @Path("{catalogId}/records/{recordId}/branches/{branchId}/commits")
    @Produces(MediaType.TEXT_PLAIN)
    @RolesAllowed("user")
    @ApiOperation("Creates a Commit for a specific Branch and sets it to be the new HEAD Commit.")
    @ActionId(value = Modify.TYPE)
    @ResourceId(type = ValueType.PATH, value = "recordId")
    @ActionAttributes(
            @AttributeValue(type = ValueType.PATH, id = VersionedRDFRecord.branch_IRI, value = "branchId")
    )
    public Response createBranchCommit(@Context ContainerRequestContext context,
                                @PathParam("catalogId") String catalogId,
                                @PathParam("recordId") String recordId,
                                @PathParam("branchId") String branchId,
                                @QueryParam("message") String message) {
        try {
            checkStringParam(message, "Commit message is required");
            User activeUser = getActiveUser(context, engineManager);
            Resource newCommitId = versioningManager.commit(vf.createIRI(catalogId), vf.createIRI(recordId),
                    vf.createIRI(branchId), activeUser, message);
            return Response.status(201).entity(newCommitId.stringValue()).build();
        } catch (IllegalArgumentException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.BAD_REQUEST);
        } catch (IllegalStateException | MobiException ex) {
            throw ErrorUtils.sendError(ex, ex.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
        }
    }

}