Make the variable to be local

We are facing a problem where the object is being added more than once
and create duplcation in the data. This should solve it because it will reset
everytime we run this API.