public void cleanEntity(final AbstractPreDatabaseOperationEvent event) {
Object src = event.getEntity();
EventSource eventSource = event.getSession();
if (src instanceof Entity) {
try {
BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
Class propertyType = propertyDescriptor.getType();
Object propertyValue = propertyDescriptor.getValue(src);
if (Entity.class.isAssignableFrom(propertyType)) {
Entity entity = (Entity) propertyValue;