Edit message logic with locks.