Create factory method for create and get database instance