WL-3192 Remove the realm if it is empty

We are considering a realm to be empty if it has no roles nor members and
before saving we should remove any roles which have no permissions set.