private Element createBrandElem(
      Brand brand,
      DateTime originalPublicationDate,
      DateTime brandEndDate,
      String lastModified,
      LakeviewContentGroup contentGroup,
      int addedSeasons) {

    Element element = createElement("TVSeries", LAKEVIEW);
    addIdElements(element, brandId(brand), providerMediaId(brand));
    addTitleElements(
        element, Strings.isNullOrEmpty(brand.getTitle()) ? "EMPTY BRAND TITLE" : brand.getTitle());

    appendCommonElements(
        element,
        brand,
        originalPublicationDate,
        lastModified,
        brandAtomUri(findTagAlias(brand)),
        brand.getGenres(),
        null);
    if (addedSeasons > 0) {
      element.appendChild(
          stringElement("TotalNumberOfSeasons", LAKEVIEW, String.valueOf(addedSeasons)));
    }

    element.appendChild(
        stringElement(
            "TotalNumberOfEpisodes", LAKEVIEW, String.valueOf(countEpisodes(contentGroup))));

    if (brand.getPresentationChannel() != null
        && channelResolver.fromKey(brand.getPresentationChannel()).hasValue()) {
      element.appendChild(
          stringElement(
              "Network",
              LAKEVIEW,
              channelResolver.fromKey(brand.getPresentationChannel()).requireValue().getTitle()));
    } else {
      List<Broadcast> broadcasts = extractBroadcasts(contentGroup.episodes());
      if (!broadcasts.isEmpty()) {
        element.appendChild(stringElement("Network", LAKEVIEW, extractNetwork(broadcasts)));
      } else {
        return null;
      }
    }

    if (brandEndDate != null) {
      element.appendChild(
          stringElement("EndYear", LAKEVIEW, String.valueOf(brandEndDate.getYear())));
    }

    return element;
  }
  Element createSeriesElem(
      Series series, Brand parent, DateTime originalPublicationDate, String lastModified) {
    Element element = createElement("TVSeason", LAKEVIEW);
    String applicationSpecificData = seriesAtomUri(findTagAlias(series));
    String seriesId = seriesId(series);
    String providerMediaId = providerMediaId(series);
    addIdElements(element, seriesId, providerMediaId);

    if (genericTitlesEnabled) {
      if (series.getSeriesNumber() != null) {
        addTitleElements(element, String.format("Series %d", series.getSeriesNumber()));
      } else if (!Strings.isNullOrEmpty(series.getTitle())) {
        addTitleElements(element, String.format("Series %d", series.getTitle()));
      } else {
        addTitleElements(element, parent.getTitle());
      }
    } else if (Strings.isNullOrEmpty(series.getTitle())
        || series.getTitle().matches("(?i)series \\d+")) {
      addTitleElements(
          element, String.format("%s Series %s", parent.getTitle(), series.getSeriesNumber()));
    } else {
      addTitleElements(element, series.getTitle());
    }

    Set<String> genres =
        Iterables.isEmpty(series.getGenres()) ? parent.getGenres() : series.getGenres();
    appendCommonElements(
        element,
        series,
        originalPublicationDate,
        lastModified,
        applicationSpecificData,
        genres,
        null);

    element.appendChild(
        stringElement("SeasonNumber", LAKEVIEW, String.valueOf(series.getSeriesNumber())));
    element.appendChild(stringElement("SeriesId", LAKEVIEW, brandId(parent)));

    return element;
  }