add method for edit page
convert code to controller