Add replace function to purge all database before adding every record. Also add a delete before insert function when writing to DB, preventing SMS duplicates
Added optimization: don't to the single deletion if we have purged the DB before, it's useless