Prevent saving duplicate security groups

We use the ownerId and groupId to distinguish a security group