Task (String message, TaskManager manager) { TaskRepository[] repositories = manager.getAllRepositories(); for (TaskRepository repository : repositories) { String id = repository.extractId(message); if (id == null) continue; LocalTask localTask = manager.findTask(id); if (localTask != null) return localTask; try { Task task = repository.findTask(id); if (task != null) { return task; } } catch (Exception ignore) { } } return null; }