try {
contentRepository.delete(liveURI);
ResourceURI workURI = new ResourceURIImpl(liveURI, Resource.WORK);
if (!contentRepository.exists(workURI)) {
logger.debug("Creating work version of {}", workURI);
PageReader reader = new PageReader();
Page workPage = reader.read(IOUtils.toInputStream(livePage.toXml(), "utf-8"), site);
workPage.setVersion(Resource.WORK);
workPage.setPublished(null, null, null);
contentRepository.putAsynchronously(workPage);
}
logger.info("Page {} has been unpublished by {}", liveURI, user);