 DECLARE @hl7OrgId INT
 DECLARE @lcgGroupId INT
 DECLARE @hl7GroupId INT
+DECLARE @hl7AdminUserId INT
 
 SET @lcgOrgId = (SELECT TOP 1 id FROM organization WHERE name = 'LCG')
 SET @hl7OrgId = (SELECT TOP 1 id FROM organization WHERE name = 'HL7')

	INSERT INTO [group] (name, organizationId) VALUES ('HL7', @hl7OrgId)
	SET @hl7GroupId = @@IDENTITY

	INSERT INTO user_group (userId, groupId)
	SELECT id, @lcgGroupId FROM [user] WHERE email = 'sean.mcilvenna@lantanagroup.com' OR email = 'sarah.gaunt@lantanagroup.com'
END

IF (@lcgOrgId IS NOT NULL AND @lcgGroupId IS NOT NULL)

	INSERT INTO [group] (name, organizationId) VALUES ('LCG', @lcgOrgId)
	SET @lcgGroupId = @@IDENTITY

	INSERT INTO group_manager (userId, groupId)
	SELECT id, @lcgGroupId FROM [user] WHERE email = 'sean.mcilvenna@lantanagroup.com' OR email = 'sarah.gaunt@lantanagroup.com'
END

