POC for fixing #2159
Fix #2159: make sure to remove old events when creating new documentarray