@Override
protected void onBeforeSave(Object entity) {
PersistentEntity persistentEntity = persistentEntityFor(entity.getClass());
NotEmptyFileReferencePropertiesCollector propertyValueCollector = new NotEmptyFileReferencePropertiesCollector(entity);
persistentEntity.doWithProperties(propertyValueCollector);
FileReferenceProperties fileReferenceProperties = propertyValueCollector.getFilePropertyValues();
persistentEntity.doWithProperties(new FileReferencePropertiesValueEraser(entity, fileReferenceProperties));