*/
public void createMembership(Membership m, boolean broadcast) throws Exception
{
if (service.getMembershipTypeHandler().findMembershipType(m.getMembershipType()) == null)
{
throw new InvalidNameException("Can not create membership record " + m.getId() + " because membership type "
+ m.getMembershipType() + " does not exists.");
}
if (service.getGroupHandler().findGroupById(m.getGroupId()) == null)
{
throw new InvalidNameException("Can not create membership record " + m.getId() + ", because group "
+ m.getGroupId() + " does not exist.");
}
if (service.getUserHandler().findUserByName(m.getUserName()) == null)
{
throw new InvalidNameException("Can not create membership record " + m.getId() + ", because user "
+ m.getGroupId() + " does not exist.");
}
// check if we already have membership record
if (findMembershipByUserGroupAndType(m.getUserName(), m.getGroupId(), m.getMembershipType()) != null)