@WorkerThread
    @SuppressWarnings("PMD.NPathComplexity") // readability won't be imporved upon split
    static LogResult createLogTaskLogic(final Geocache cache, final OfflineLogEntry logEntry, final Map<String, Trackable> inventory, final Consumer<String> progress) {


        try (ContextLogger cLog = new ContextLogger("LogUtils.createLogTaskLogic(%s, %s)", cache.getGeocode(), logEntry)) {
            try {
                final ILoggingManager loggingManager = cache.getLoggingManager();
                final IConnector cacheConnector = loggingManager.getConnector();

                //Upload new log entry
                progress.accept(LocalizationUtils.getString(R.string.log_posting_log));
                final LogResult logResult = loggingManager.createLog(logEntry, inventory);
                if (!logResult.isOk()) {
                    return logResult;
                }

                //if necessary: upload a second log entry for problem report
                final LogEntry adaptedLogEntryProblemReport;
                if (logEntry.reportProblem != ReportProblemType.NO_PROBLEM && !loggingManager.canLogReportType(logEntry.reportProblem)) {
                    progress.accept(LocalizationUtils.getString(R.string.log_posting_problemreport));
                    final OfflineLogEntry logEntryProblemReport = new OfflineLogEntry.Builder()
                        .setLogType(logEntry.reportProblem.logType)
                        .setDate(logEntry.date)
                        .setLog(LocalizationUtils.getString(logEntry.reportProblem.textId))
                        .setPassword(logEntry.password)
                        .build();
                    final LogResult logResultProblemReport = loggingManager.createLog(logEntryProblemReport, null);
                    if (!logResultProblemReport.isOk()) {
                        return logResultProblemReport;
                    }
                    adaptedLogEntryProblemReport = applyCommonsToOwnLog(logEntryProblemReport.buildUpon(), cacheConnector)
                        .setServiceLogId(logResultProblemReport.getServiceLogId())
                        .build();
                } else {
                    adaptedLogEntryProblemReport = null;
                }

                //upload images
                final ImmutableTriple<ImageResult, List<Image>, Runnable> imgResult =
                    updateImages(loggingManager, logResult.getServiceLogId(), Collections.emptyList(), logEntry.logImages, progress);
                if (!imgResult.left.isOk()) {
                    return LogResult.error(imgResult.left.getStatusCode(), imgResult.left.getPostServerMessage(), null);
                }

                progress.accept(LocalizationUtils.getString(R.string.log_posting_save_internal));

                //adapt logs in database
                final LogEntry adaptedNewLogEntry = applyCommonsToOwnLog(logEntry.buildUpon(), cacheConnector)
                    .setServiceLogId(logResult.getServiceLogId())
                    .setLogImages(imgResult.middle)
                    .build();

                changeLogsInDatabase(cache, logs -> {
                    logs.add(0, adaptedNewLogEntry);
                    if (adaptedLogEntryProblemReport != null) {
                        logs.add(0, adaptedLogEntryProblemReport);
                    }
                });
                //adapt commons in database
                adaptCacheCommonsAfterLogging(cache, loggingManager, null, adaptedNewLogEntry);
                // update offline log in DB
                cache.clearOfflineLog(null);
                //update favorites
                if (loggingManager.supportsLogWithFavorite() && logEntry.favorite) {
                    cache.setFavorite(true);
                    cache.setFavoritePoints(cache.getFavoritePoints() + 1);
                }
                DataStore.saveChangedCache(cache);

                //Cleanup temporary images
                imgResult.right.run();

                //update trackable actions
                if (loggingManager.supportsLogWithTrackables()) {
                    for (Map.Entry<String, LogTypeTrackable> entry : logEntry.inventoryActions.entrySet()) {
                        LastTrackableAction.setAction(entry.getKey(), entry.getValue());
                    }
                }

                //Execute Log-actions NOT resulting in a log error being reported to user

                postCacheRating(cacheConnector, cache, logEntry.rating, progress);
                postGenericInventoryLogs(cache, logEntry, inventory.values(), progress);

                cache.notifyChange();
                return logResult;

            } catch (final RuntimeException e) {
                cLog.setException(e);
                Log.e("LogUtils.createLogTaskLogic", e);
                return LogResult.error(StatusCode.LOG_POST_ERROR, "LogUtils.createLogTaskLogic", e);
            } finally {
                cLog.endLog();
            }
        }
    }
get title for a log image in the list
main/src/main/java/cgeo/geocaching/log/LogUtils.java