public static ITakeRateDocument FromFilter(TakeRateFilter filter)
        {
            var volume = new TakeRateDocument();

            if (filter.TakeRateId.HasValue)
            {
                volume.TakeRateId = filter.TakeRateId;
            }

            volume.UnderlyingOxoDocument = filter.DocumentId.HasValue ? new OXODoc()
            {
                Id = filter.DocumentId.Value
            } : new EmptyOxoDocument();

            if (filter.ProgrammeId.HasValue)
            {
                volume.Vehicle = new Vehicle()
                {
                    ProgrammeId = filter.ProgrammeId.Value, Gateway = filter.Gateway
                };
            }

            if (filter.MarketGroupId.HasValue)
            {
                volume.MarketGroup = new MarketGroup()
                {
                    Id = filter.MarketGroupId.Value
                };
            }

            if (filter.MarketId.HasValue)
            {
                volume.Market = new Market()
                {
                    Id = filter.MarketId.Value
                };
            }

            if (!string.IsNullOrEmpty(filter.BMC))
            {
                volume.BMC = filter.BMC;
            }

            if (!string.IsNullOrEmpty(filter.DPCK))
            {
                volume.DPCK = filter.DPCK;
            }

            if (!string.IsNullOrEmpty(filter.FeatureCode))
            {
                volume.FeatureCode = filter.FeatureCode;
            }

            volume.Mode = filter.Mode;

            return(volume);
        }
        public static ITakeRateDocument FromFilter(TakeRateFilter filter)
        {
            var volume = new TakeRateDocument();

            if (filter.TakeRateId.HasValue)
            {
                volume.TakeRateId = filter.TakeRateId;
            }

            volume.UnderlyingOxoDocument = filter.DocumentId.HasValue ? new OXODoc() {Id = filter.DocumentId.Value} : new EmptyOxoDocument();

            if (filter.ProgrammeId.HasValue)
            {
                volume.Vehicle = new Vehicle() { ProgrammeId = filter.ProgrammeId.Value, Gateway = filter.Gateway };
            }

            if (filter.MarketGroupId.HasValue)
            {
                volume.MarketGroup = new MarketGroup() { Id = filter.MarketGroupId.Value };
            }

            if (filter.MarketId.HasValue)
            {
                volume.Market = new Market() { Id = filter.MarketId.Value };
            }

            if (!string.IsNullOrEmpty(filter.BMC))
            {
                volume.BMC = filter.BMC;
            }

            if (!string.IsNullOrEmpty(filter.DPCK))
            {
                volume.DPCK = filter.DPCK;
            }

            if (!string.IsNullOrEmpty(filter.FeatureCode))
            {
                volume.FeatureCode = filter.FeatureCode;
            }

            volume.Mode = filter.Mode;

            return volume;
        }