reading references json array and storing data in db