fix create_or_update logic to avoid rollbacks

check if entry exists rather than blindly adding entries to table.
this will avoid unnecessary rollback overhead.

Closes-Bug: #1295504
Change-Id: I923cc35ed4c9155ffa04ac189555cdbcb38bcbcf
Merge "fix create_or_update logic to avoid rollbacks"