protected ScriptOperationContext wrapContext(ScriptOperationContext ctx) {
   for (String entryId : ctx.keySet()) {
     Object entry = ctx.get(entryId);
     if (entry instanceof DocumentModel) {
       ctx.put(entryId, new DocumentWrapper(ctx.getCoreSession(), (DocumentModel) entry));
     }
     if (entry instanceof DocumentModelList) {
       List<DocumentWrapper> docs = new ArrayList<>();
       for (DocumentModel doc : (DocumentModelList) entry) {
         docs.add(new DocumentWrapper(ctx.getCoreSession(), doc));
       }
       ctx.put(entryId, docs);
     }
   }
   return ctx;
 }