class QuickLinksProfileBuilder {

  public String buildQuickLinksProfile(@Nullable Object globalFiltersRaw, @Nullable Object serviceFiltersRaw) throws QuickLinksProfileEvaluationException {
    try {
      List<Filter> globalFilters = buildQuickLinkFilters(globalFiltersRaw);
      List<Service> services = buildServices(serviceFiltersRaw);
      QuickLinksProfile profile = QuickLinksProfile.create(globalFilters, services);
      // sanity check: this should throw QuickLinksProfileEvaluationException if the profile is invalid
      new DefaultQuickLinkVisibilityController(profile);
      return new QuickLinksProfileParser().encode(profile);
    }
    catch (QuickLinksProfileEvaluationException ex) {
      throw ex;
    }
    catch (Exception ex) {
      throw new QuickLinksProfileEvaluationException("Error interpreting quicklinks profile data", ex);
    }
  }

}