EDOC-1668 Fix locking and change logging