first restructure. It cannot add to database now since addToDatabase is
not check