fixed the bug. insert a record if not exist in db.