Implemented optimistic lock