add checks for edit and update