Move common code for instantiating models into the Factory