moved logic to controller for delete