/** * Saves the document and clear context data to avoid incrementing version in next operations if * not needed. */ public static DocumentModel saveDocument(CoreSession session, DocumentModel doc) throws ClientException { doc = session.saveDocument(doc); return session.getDocument(doc.getRef()); }