LuceneWorkSerializer serializer = indexManager.getSerializer();
DirectoryDAO directoryDAO = new DirectoryDAO();
WorkListDAO workListDAO = new WorkListDAO();
Directory directory = directoryDAO.findByName(indexManager.getIndexName());
boolean someFailureHappened = false;
try {
try {
workListDAO.create(directory, serializer.toSerializedModel(workList));
LOG.info("Scheduled " + workList.size() + " works in " + directory.getName() + " directory to be performed in future");
} catch (Exception e) {
someFailureHappened = true;
errorContextBuilder.errorThatOccurred(e.getCause());
}