protected async virtual Task ValidateIntFieldValueAsync(RecordValidationContext context)
        {
            var records = context.FormRecord.Values.Where(_ => _ is IntFieldValue).Select(_ => _ as IntFieldValue);

            foreach (var record in records)
            {
                var fieldDefinition = record.FieldDefinition as IntField;

                if (fieldDefinition.IsRequired && !record.Value.HasValue)
                {
                    context.AddRecordError(record, "required validation failure");
                }

                if (fieldDefinition.IsUnique && record.Value.HasValue)
                {
                    var fieldRecordValidationContext = new UniqueValueValidationContext(context.FormId, record);
                    await _fieldRecordUniqueValidator.ValidateAsync(fieldRecordValidationContext);

                    if (!fieldRecordValidationContext.IsValid)
                    {
                        context.AddRecordError(record, fieldRecordValidationContext.ErrorMessage);
                    }
                }

                if (record.Value.IsOutOfRange(fieldDefinition.Min, fieldDefinition.Max))
                {
                    context.AddRecordError(record, "range validation failure");
                }
            }
        }
        protected async virtual Task ValidateTextboxFieldValueAsync(RecordValidationContext context)
        {
            var records = context.FormRecord.Values.Where(_ => _ is TextboxFieldValue).Select(_ => _ as TextboxFieldValue);

            foreach (var record in records)
            {
                var fieldDefinition = record.FieldDefinition as TextboxField;

                if (fieldDefinition.IsRequired && record.Value.IsMissing())
                {
                    context.AddRecordError(record, "required validation failure");
                }

                if (fieldDefinition.IsUnique && record.Value.IsPresent())
                {
                    var fieldRecordValidationContext = new UniqueValueValidationContext(context.FormId, record);
                    await _fieldRecordUniqueValidator.ValidateAsync(fieldRecordValidationContext);

                    if (!fieldRecordValidationContext.IsValid)
                    {
                        context.AddRecordError(record, fieldRecordValidationContext.ErrorMessage);
                    }
                }

                if (record.Value.IsTooLong(fieldDefinition.MaxLength))
                {
                    context.AddRecordError(record, "max length validation failure");
                }
            }
        }
        protected virtual Task ValidateSliderFieldValueAsync(RecordValidationContext context)
        {
            var records = context.FormRecord.Values.Where(_ => _ is SliderFieldValue).Select(_ => _ as SliderFieldValue);

            foreach (var record in records)
            {
                var fieldDefinition = record.FieldDefinition as SliderField;

                if (fieldDefinition.IsRequired && !record.Value.HasValue)
                {
                    context.AddRecordError(record, "required validation failure");
                }

                if (record.Value.IsOutOfRange(fieldDefinition.Min, fieldDefinition.Max))
                {
                    context.AddRecordError(record, "range validation failure");
                }
            }

            return(Task.CompletedTask);
        }
        protected virtual Task ValidateUploadFieldValueAsync(RecordValidationContext context)
        {
            var records = context.FormRecord.Values.Where(_ => _ is UploaderFieldValue).Select(_ => _ as UploaderFieldValue);

            foreach (var record in records)
            {
                var fieldDefinition = record.FieldDefinition as UploaderField;

                if (fieldDefinition.IsRequired && record.Value.IsNullOrEmpty())
                {
                    context.AddRecordError(record, "required validation failure");
                }
            }

            return(Task.CompletedTask);
        }