Persist presence data to the database if requested

This allows us to restart the server without users being aware (well providing it restarts quickly enough).

Fixes #213
No it should be ok, we've added a database call but otherwise all good.