Check models are valid before populating memberships

Avoid errors with possibly null models by compacting the models array to
remove falsy values and filtering the array to ensure all members have
the required method.