Source:
public ContentHierarchyAndSummaries process(ProgData progData, Channel channel, DateTimeZone zone, Timestamp updatedAt) { try { if (! Strings.isNullOrEmpty(progData.getSeriesId()) && IGNORED_BRANDS.contains(progData.getSeriesId())) { return null; } Optional<Brand> possibleBrand = getBrand(progData, channel, updatedAt); Brand brandSummary = null; if (possibleBrand.isPresent() && hasBrandSummary(progData)) { brandSummary = getBrandSummary(progData, possibleBrand.get(), updatedAt); } Optional<Series> possibleSeries = getSeries(progData, channel, updatedAt); Series seriesSummary = null; if (possibleSeries.isPresent() && hasSeriesSummary(progData)) { seriesSummary = getSeriesSummary(progData, possibleSeries.get(), updatedAt); } ItemAndBroadcast itemAndBroadcast = isClosedBrand(possibleBrand) ? getClosedEpisode(possibleBrand.get(), progData, channel, zone, updatedAt) : getFilmOrEpisode(progData, channel, zone, possibleBrand.isPresent() || possibleSeries.isPresent(), updatedAt); Item item = itemAndBroadcast.getItem(); item.setGenericDescription(isGenericDescription(progData)); item.addAlias(PaHelper.getProgIdAlias(progData.getProgId())); item.setLastUpdated(updatedAt.toDateTimeUTC()); return new ContentHierarchyAndSummaries(possibleBrand, possibleSeries, item, itemAndBroadcast.getBroadcast().requireValue(), Optional.fromNullable(brandSummary), Optional.fromNullable(seriesSummary)); } catch (Exception e) { e.printStackTrace(); log.record(new AdapterLogEntry(Severity.ERROR).withCause(e).withSource(PaProgrammeProcessor.class).withDescription(e.getMessage())); } return null; }

Target:
public Optional<ContentHierarchyAndSummaries> process(ProgData progData, Channel channel, DateTimeZone zone, Timestamp updatedAt) { try { if (! Strings.isNullOrEmpty(progData.getSeriesId()) && IGNORED_BRANDS.contains(progData.getSeriesId())) { return Optional.absent(); } Optional<Brand> possibleBrand = getBrand(progData, channel, updatedAt); Brand brandSummary = null; if (possibleBrand.isPresent() && hasBrandSummary(progData)) { brandSummary = getBrandSummary(progData, possibleBrand.get(), updatedAt); } Optional<Series> possibleSeries = getSeries(progData, channel, updatedAt); Series seriesSummary = null; if (possibleSeries.isPresent() && hasSeriesSummary(progData)) { seriesSummary = getSeriesSummary(progData, possibleSeries.get(), updatedAt); } ItemAndBroadcast itemAndBroadcast = isClosedBrand(possibleBrand) ? getClosedEpisode(possibleBrand.get(), progData, channel, zone, updatedAt) : getFilmOrEpisode(progData, channel, zone, possibleBrand.isPresent() || possibleSeries.isPresent(), updatedAt); Item item = itemAndBroadcast.getItem(); item.setGenericDescription(isGenericDescription(progData)); item.addAlias(PaHelper.getProgIdAlias(progData.getProgId())); item.setLastUpdated(updatedAt.toDateTimeUTC()); return Optional.of(new ContentHierarchyAndSummaries(possibleBrand, possibleSeries, item, itemAndBroadcast.getBroadcast().requireValue(), Optional.fromNullable(brandSummary), Optional.fromNullable(seriesSummary))); } catch (Exception e) { e.printStackTrace(); log.record(new AdapterLogEntry(Severity.ERROR).withCause(e).withSource(PaProgrammeProcessor.class).withDescription(e.getMessage())); } return Optional.absent(); }