On the Evolution of Collective Enforcement Institutions: Communities and Courts