complete delete function with database.