private async Task <bool> CanTaskBeEnded(Instance instance, string currentElementId) { List <ValidationIssue> validationIssues = new List <ValidationIssue>(); bool canEndTask; if (instance.Process?.CurrentTask?.Validated == null || !instance.Process.CurrentTask.Validated.CanCompleteTask) { validationIssues = await _validationService.ValidateAndUpdateInstance(instance, currentElementId); canEndTask = await _altinnApp.CanEndProcessTask(currentElementId, instance, validationIssues); } else { canEndTask = await _altinnApp.CanEndProcessTask(currentElementId, instance, validationIssues); } return(canEndTask); }