Moved persist settings and dates to common function