public async Task <ValidationResult> ValidateEntity <T>(T entity)
        {
            ValidationResult rtn = new ValidationResult();
            //var validators = await this.StateManager.GetOrAddAsync<IReliableDictionary<ComparableType, IGoodVibesValidator>>(ValidatorDictionary);
            var validators = await this.StateManager.GetOrAddAsync <IReliableDictionary <string, List <XElement> > >(SerializedValidatorDictionary);

            using (var tx = this.StateManager.CreateTransaction())
            {
                var conditionalValidatorRules = await validators.TryGetValueAsync(tx, typeof(T).AssemblyQualifiedName);

                if (conditionalValidatorRules.HasValue)
                {
                    foreach (var xml in conditionalValidatorRules.Value)
                    {
                        try
                        {
                            var x = _serializer.Deserialize <Func <T, ValidationMessage> >(xml);
                        }
                        catch (Exception ex)
                        {
                            Trace.TraceError(ex.ToString());
                        }
                    }
                    var validationRules = conditionalValidatorRules.Value.Select(x => _serializer.Deserialize <Func <T, ValidationMessage> >(x)).ToList();
                    var typeValidator   = GoodVibesValidator <T> .Create(validationRules);

                    var result = typeValidator.Validate(entity);
                    rtn.AddValidationResults(result);
                }
            }
            return(rtn);
        }
        public async Task <ValidationResult> ValidateSnowReport(SnowReport report)
        {
            //see comments above
            ValidationResult rtn = new ValidationResult();
            var baseResult       = this.ValidateEntity <ReportBase>(report as ReportBase);
            var coreResult       = this.ValidateEntity <SnowReport>(report);
            await Task.WhenAll(baseResult, coreResult);

            rtn.AddValidationResults(new ValidationResult[2] {
                baseResult.Result, coreResult.Result
            });
            return(rtn);
        }
        public async Task <ValidationResult> ValidateSurfReport(SurfReport report)
        {
            ValidationResult rtn = new ValidationResult();
            //There may be a better way to do this, but the generic arguments required from the serialization library don't allow you to pass in a more derived type and get
            //return type covariance. Although I always seem to run into this problem in C#.... So, we need to manually validate against the known base types.
            var baseResult = this.ValidateEntity <ReportBase>(report as ReportBase);
            var coreResult = this.ValidateEntity <SurfReport>(report);
            //These two tasks can be run in parallel. So do it.
            await Task.WhenAll(baseResult, coreResult);

            //I don't really know how to use a synchronous continue with call, so let's just force synchrocity this way
            rtn.AddValidationResults(new ValidationResult[2] {
                baseResult.Result, coreResult.Result
            });
            return(rtn);
        }