Fixed ERRAI-474: Allow the addition of primitive attributes to entities that have been persisted

Pulled out LocalStorage into its own class so it could be used by the tests as well. Might come in handy later
on for other people too.