add activerecord code and create insert and delete action to the index controller