Reworking database to use UnitOfWork pattern. Minor fixes to datetime and small changes.