add insert logic into index file