`addModelsToResources` has to be defined before it, otherwise you get `listener must be a function`