Edit ContextFactory, unit test for ContextFactory and Database