if (data.hasError) {
throw new WebApplicationException(Response.Status.PRECONDITION_FAILED);
}
persistenceSvc.beginTx();
EntityManager em = persistenceSvc.getEntityManager();
MedicalEvent entity = data.resolveEntity(em);
createEntity(data.resolveEntity(em));
persistenceSvc.commitTx();
return Response.created(uriInfo.getAbsolutePath().resolve(entity.getMedicalEventId() + "/")).build();
} finally {
persistenceSvc.close();
}
}