@ApiOperation(value = "Delete a model", tags = { "Models" }, code = 204)
    @ApiResponses(value = {
            @ApiResponse(code = 204, message = "Indicates the model was found and has been deleted. Response-body is intentionally empty."),
            @ApiResponse(code = 404, message = "Indicates the requested model was not found.")
    })
    @DeleteMapping("/repository/models/{modelId}")
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void deleteModel(@ApiParam(name = "modelId") @PathVariable String modelId) {
        Model model = getModelFromRequest(modelId);
        repositoryService.deleteModel(model.getId());
    }
@Test
    public void testDeleteModel() throws Exception {
        Model model = null;
        try {
            Calendar now = Calendar.getInstance();
            now.set(Calendar.MILLISECOND, 0);
            processEngineConfiguration.getClock().setCurrentTime(now.getTime());

            model = repositoryService.newModel();
            model.setCategory("Model category");
            model.setKey("Model key");
            model.setMetaInfo("Model metainfo");
            model.setName("Model name");
            model.setVersion(2);
            repositoryService.saveModel(model);

            HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_MODEL, model.getId()));
            closeResponse(executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT));

            // Check if the model is really gone
            assertThat(repositoryService.createModelQuery().modelId(model.getId()).singleResult()).isNull();

            model = null;
        } finally {
            if (model != null) {
                try {
                    repositoryService.deleteModel(model.getId());
                } catch (Throwable ignore) {
                    // Ignore, model might not be created
                }
            }
        }
    }