Restore fix for unneeded DB rewrites
Restore fix for unneeded DB rewrites

This fix was introduced in commit a671e47b37821350fc12afcf4905263e4d292b60 and
later lost in a wrong merge.

smita30apr/my-libaccounts-ui,nemomobile-graveyard/libaccounts-ui,nemomobile-graveyard/libaccounts-ui,smita30apr/my-libaccounts-ui