Lazy loading of database reference from app delegate. Cleanup.