dataFileWriter.create(schema, file);
GenericRecord record = contextToGeneric(context);
dataFileWriter.append(record);
} catch (IOException e) {
LOG.log(Level.SEVERE, "Failed to sotre context. IOException. Error message: " + e.getMessage());
throw new PersistencyException("Saving context failed due to error of writing to file " + filePath);
} finally {
try {
dataFileWriter.close();
} catch (IOException e) {
LOG.log(Level.WARNING, "Failed to close DataFileWriter after storing context. The message is: " + e.getMessage());