updated resourceToModel so that it takes the model as a parameter rather than just its class_name