insert data to database and notify UI refresh