Replace redundant code with getParticipantCountforEvent function