insert or update the database of course