Used AsyncTask to not let the UI be updated until the DataBase was done.