How to limit the number of members in an organization?

I would like to limit the number of members certain organizations are allowed to have. For example I might want one organization to allow only 5 members. Assuming this needs to be done with a custom action, which event could I hook into to implement this? Pre-registration seems like an option but I’m not sure if that includes the org membership process.

Thanks