implement saveWithLock method and enhance workflow step handling