protected async void ValueRangeValidation <T>(T value, int min, int max, string propertyKey) { ICollection <string> validationErrors = null; /* Call service asynchronously */ bool isValid = await Task.Run(() => _validateService.ValueRangeValidation(value, min, max, out validationErrors)) .ConfigureAwait(false); if (!isValid) { /* Update the collection in the dictionary returned by the GetErrors method */ ValidationErrors[propertyKey] = validationErrors; /* Raise event to tell WPF to execute the GetErrors method */ RaiseErrorsChanged(propertyKey); } else if (ValidationErrors.ContainsKey(propertyKey)) { /* Remove all errors for this property */ ValidationErrors.Remove(propertyKey); /* Raise event to tell WPF to execute the GetErrors method */ RaiseErrorsChanged(propertyKey); } }