void (Iterator<? extends Content> iterator, AsyncPromise<Void> result, Function<? super ServiceView, ? extends Promise<?>> action, Consumer<? super Content> onSuccess) { Content content = iterator.next(); ServiceView serviceView = getServiceView(content); if (serviceView == null || content.getManager() == null) { if (iterator.hasNext()) { promiseFindView(iterator, result, action, onSuccess); } else { result.setError("Not services content"); } return; } action.apply(serviceView) .onSuccess(v -> { if (onSuccess != null) { onSuccess.accept(content); } result.setResult(null); }) .onError(e -> { if (iterator.hasNext()) { AppUIExecutor.onUiThread().expireWith(serviceView.getProject()).submit(() -> { promiseFindView(iterator, result, action, onSuccess); }); } else { result.setError(e); } }); }