implement update operation in sample