Ugly but functional approach to persistence.