reattach(session, authority);
if (parentAuthority != null) {
subSegment = DbSubSegment.ByParentAndName(session, (DbAuthority) parentAuthority, subSegmentName);
if (subSegment != null) throw new StoreDuplicateEntryException("Subsegment exists already.");
}
if (authority != null && parentAuthority != null &&
authority.equals(parentAuthority)) authority = parentAuthority;