saves history item to database