Added validation to edit and add