Fixed error in edit view and added cascade deletion