How to edit and replace data