Using a factory to create domain objects