/// <inheritdoc />
        public void Intercept(IRequestProcessorInvocation invocation)
        {
            if (invocation.Request.Context.Headers.ContainsKey(SetCurrentCultureInContextInterceptor.CultureHeaderKey))
            {
                Thread.CurrentThread.CurrentCulture =
                    CultureInfo.GetCultureInfo(
                        invocation.Request.Context.Headers[SetCurrentCultureInContextInterceptor.CultureHeaderKey]);
            }

            if (invocation.Request.Context.Headers.ContainsKey(SetCurrentCultureInContextInterceptor.UICultureHeaderKey))
            {
                Thread.CurrentThread.CurrentUICulture =
                    CultureInfo.GetCultureInfo(
                        invocation.Request.Context.Headers[SetCurrentCultureInContextInterceptor.UICultureHeaderKey]);
            }

            invocation.Proceed();
        }
        /// <inheritdoc />
        public void Intercept(IRequestProcessorInvocation invocation)
        {
            var validationResponse = invocation.Response as IValidationResults;
            if (validationResponse != null)
            {
                var validationResults = new Collection<ValidationResult>();
                if (
                    !Validator.TryValidateObject(
                        invocation.Request,
                        new ValidationContext(invocation.Request),
                        validationResults,
                        true))
                {
                    validationResponse.ValidationResults = validationResults;
                    return;
                }
            }
            else
            {
                Validator.ValidateObject(invocation.Request, new ValidationContext(invocation.Request), true);
            }

            invocation.Proceed();
        }
 /// <inheritdoc />
 public void Intercept(IRequestProcessorInvocation invocation)
 {
     invocation.Request.Context.Headers[CultureHeaderKey] = CultureInfo.CurrentCulture.Name;
     invocation.Request.Context.Headers[UICultureHeaderKey] = CultureInfo.CurrentUICulture.Name;
     invocation.Proceed();
 }