code: private void checkExistingMapping(StreamSegmentMapOperation operation) throws MetadataUpdateException {
          long existingSegmentId = getStreamSegmentId(operation.getStreamSegmentName(), false);
          if (existingSegmentId != ContainerMetadata.NO_STREAM_SEGMENT_ID
                  && existingSegmentId != operation.getStreamSegmentId()) {
              throw new MetadataUpdateException(this.containerId,
                      String.format("Operation '%s' wants to map a Segment that is already mapped in the metadata. Existing Id = %d.",
                              operation, existingSegmentId));
          }
      }
docs: region Helpers