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