Factor out time conversion for re-use.

Change-Id: Ic206cf49fee486e65f27d6c6896885d1e763f160
Use the newer style way of fallback setting attributes.

According to the internet, this is now preferred over direct access
to __dict__.

Change-Id: I9d0b8e8f598ca48cac2b9292e03bd8bc91dede7f
Make it possible to have optional db properties.

Change-Id: I5942b590a17b7fade7fb852d09d12adeee48cbd7