Implement the factory pattern for data storage