Better merging for sgroups.

This fixes the issue where rules are exactly the same except for the
security group that they are configured against. Ideally we should
normalize our rules first but this will work to get things functional as
quickly as possible while allowing for a refactor if necessary later.