Dispatch postPersist callbacks/events for upserted documents

Fixes #560.