public static FdpDerivativeMapping FromParameters(DerivativeMappingParameters parameters)
 {
     return new FdpDerivativeMapping()
     {
         FdpDerivativeMappingId = parameters.DerivativeMappingId,
         ProgrammeId = parameters.ProgrammeId,
         Gateway = parameters.Gateway
     };
 }
 public new static OxoDerivative FromParameters(DerivativeMappingParameters parameters)
 {
     return new OxoDerivative()
     {
         BodyId = parameters.BodyId,
         EngineId = parameters.EngineId,
         TransmissionId = parameters.TransmissionId,
         DocumentId = parameters.DocumentId,
         DerivativeCode = parameters.DerivativeCode
     };
 }
 public static DerivativeMappingFilter FromDerivativeMappingParameters(DerivativeMappingParameters parameters)
 {
     return new DerivativeMappingFilter()
     {
         DerivativeMappingId = parameters.DerivativeMappingId,
         DocumentId = parameters.DocumentId,
         BodyId = parameters.BodyId,
         EngineId = parameters.EngineId,
         TransmissionId = parameters.TransmissionId,
         Action = parameters.Action
     };
 }
        protected override bool IsValid(PropertyValidatorContext context)
        {
            Parameters = context.ParentContext.InstanceToValidate as DerivativeMappingParameters;

            var filter = DerivativeMappingFilter.FromDerivativeMappingParameters(Parameters);
            filter.PageSize = int.MaxValue;

            var oxoDerivatives =
                _context.Vehicle.ListOxoDerivatives(filter).Result;

            return
                !oxoDerivatives.CurrentPage.Any(IsExistingBmc);
        }