modified PopupWindow to save into Database.