Fixed some affiliation counting logic and placed it in the corresponding model. Affiliation creation works from client.