updated the api to enhance mongo db update and simplified controller