use model factory instead of passing the class to instantiate