Move persistence code into the widget framework.