if (allArticles.size() > 0) {
Integer count = 0;
List<Knowledge__kav> scope = new List<Knowledge__kav>();
for (Knowledge__kav single : allArticles) {
if (count < BATCH_SIZE) {
count++;
scope.add(single);
} else if (count == BATCH_SIZE) {
count = 0;
System.enqueueJob(new KnowledgeEditQueue(scope));
scope = new List<Knowledge__kav>();
scope.add(single);
}
}
if (!scope.isEmpty()) {
System.enqueueJob(new KnowledgeEditQueue(scope));
}
}