code: public static <T> Response<T> buildResponse(final HttpServletRequest request, final int offset, final int limit, final long total, final List<T> elements) {
          checkArgument(offset >= 0);
          checkArgument(limit >= 1);
          checkArgument(total >= 0);
          checkArgument(total == 0 || offset < total);
  
          String requestUri = request.getRequestURI();
          String queryString = request.getQueryString();
  
          String href = requestUri + (!Strings.isNullOrEmpty(queryString) ? "?" + queryString : "");
          NavigationItem previous = new NavigationItem(hasPreviousPage(offset) ? requestUri + String.format(QUERY_STRING_FORMAT, getPreviousPageOffset(offset, limit), limit) : "");
          NavigationItem next = new NavigationItem(hasNextPage(offset, limit, total) ? requestUri + String.format(QUERY_STRING_FORMAT, getNextPageOffset(offset, limit, total), limit) : "");
          NavigationItem first = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getFirstPageOffset(), limit));
          NavigationItem last = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getLastPageOffset(total, limit), limit));
  
          return new Response<>(href, previous, next, first, last, elements);
      }
docs: Build a {@link Response} from the request, offset, limit, total and list of elements.
  
  @param request   The {@link javax.servlet.http.HttpServletRequest} which was executed.
  @param offset    The offset of the results.
  @param limit     The maximum number of results.
  @param total     The total number of elements.
  @param elements  The list of elements.
  @param <T>       The type of elements in the list. This can be {@link io.motown.chargingstationconfiguration.viewmodel.persistence.entities.ChargingStationType} or {@link io.motown.chargingstationconfiguration.viewmodel.persistence.entities.Manufacturer}.
  
  @return          A Configuration Api response with the correct metadata.
  
  @throws IllegalArgumentException when the {@code offset} is negative, the {@code limit} is lesser than or equal to 0, the {@code total} is negative and when {@code offset} is lesser than the {@code total} (only if {@code total} is greater than 0.