As above this should be reduced to a single query, rather than repeatedly making trips to the database:

```Ruby
participation_class = user == 'member' ? MemberParticipation : MentorParticipation
project_ids = participation_class.where(user_uuid: nil).map(&:project_id)
Project.find(:all, conditions: ['id not in (?)', project_ids])
```