Logic for edit view