/// <summary>
        /// Gets the contract payment filters.
        /// </summary>
        /// <param name="contractId">The contract identifier.</param>
        /// <param name="contractDataSet">The data set.</param>
        /// <returns></returns>
        private static List <PaymentTypeBase> GetContractPaymentFilters(long contractId, DataSet contractDataSet)
        {
            List <PaymentTypeBase> paymentTypes = new List <PaymentTypeBase>();

            //Add Stop loss Payment Type - use table 16
            if (contractDataSet.Tables[16] != null &&
                contractDataSet.Tables[16].Rows != null && contractDataSet.Tables[16].Rows.Count > 0 &&
                contractDataSet.Tables[16].Rows.Cast <DataRow>().Any(row => row["ContractId"] != DBNull.Value &&
                                                                     Convert.ToInt64(row["ContractId"]) ==
                                                                     contractId))
            {
                paymentTypes.Add(PaymentTypeStopLossRepository.GetPaymentType(contractId, null, contractDataSet.Tables[16]));
            }

            //Add Cap Payment Type - use table 7
            if (contractDataSet.Tables[7] != null &&
                contractDataSet.Tables[7].Rows != null && contractDataSet.Tables[7].Rows.Count > 0 &&
                contractDataSet.Tables[7].Rows.Cast <DataRow>().Any(row => row["ContractId"] != DBNull.Value &&
                                                                    Convert.ToInt64(row["ContractId"]) ==
                                                                    contractId))
            {
                paymentTypes.Add(PaymentTypeCapRepository.GetPaymentType(contractId, null, contractDataSet.Tables[7]));
            }

            //Add Lesser Of Payment Type
            if (contractDataSet.Tables[20] != null &&
                contractDataSet.Tables[20].Rows != null && contractDataSet.Tables[20].Rows.Count > 0 &&
                contractDataSet.Tables[20].Rows.Cast <DataRow>().Any(row => row["ContractId"] != DBNull.Value &&
                                                                     Convert.ToInt64(row["ContractId"]) ==
                                                                     contractId))
            {
                paymentTypes.Add(PaymentTypeLesserOfRepository.GetPaymentType(contractId, null, contractDataSet.Tables[20]));
            }

            //Add Medicare Sequester Payment Type
            if (contractDataSet.Tables[23] != null &&
                contractDataSet.Tables[23].Rows != null && contractDataSet.Tables[23].Rows.Count > 0 &&
                contractDataSet.Tables[23].Rows.Cast <DataRow>().Any(row => row["ContractId"] != DBNull.Value &&
                                                                     Convert.ToInt64(row["ContractId"]) ==
                                                                     contractId))
            {
                paymentTypes.Add(PaymentTypeMedicareSequesterRepository.GetPaymentType(contractId, null, contractDataSet.Tables[23]));
            }

            return(paymentTypes);
        }
        /// <summary>
        /// Gets the payment types.
        /// </summary>
        /// <param name="contractServiceTypeId">The contract service type identifier.</param>
        /// <param name="serviceTypeDataSet">The data set.</param>
        /// <param name="serviceTypeConditions"></param>
        /// <returns></returns>
        private static List <PaymentTypeBase> GetPaymentTypes(long contractServiceTypeId, DataSet serviceTypeDataSet, List <ICondition> serviceTypeConditions)
        {
            List <PaymentTypeBase> paymentTypes = new List <PaymentTypeBase>();

            //Add FeeSchedule Payment Type - use table 9
            if (IsValidPayment(serviceTypeDataSet.Tables[9], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeFeeScheduleRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[9],
                                                                                 serviceTypeDataSet.Tables[17], serviceTypeDataSet.Tables[18]));
            }

            //Add ASCFeeSchedule Payment Type
            if (IsValidPayment(serviceTypeDataSet.Tables[6], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeAscFeeScheduleRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[6],
                                                                                    serviceTypeDataSet.Tables[17], serviceTypeDataSet.Tables[18]));
            }

            //Add PerCase Payment Type
            if (IsValidPayment(serviceTypeDataSet.Tables[12], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypePerCaseRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[12], serviceTypeConditions));
            }

            //Add custom payment table
            if (IsValidPayment(serviceTypeDataSet.Tables[22], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeCustomTableRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[22],
                                                                                 serviceTypeDataSet.Tables[17], serviceTypeDataSet.Tables[18]));
            }

            //Add Per Diem Payment Type - use table 14
            if (IsValidPayment(serviceTypeDataSet.Tables[14], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypePerDiemRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[14]));
            }

            //Add DRG Schedules Type - use table 8
            if (IsValidPayment(serviceTypeDataSet.Tables[8], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeDrgRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[8], serviceTypeDataSet.Tables[17], serviceTypeDataSet.Tables[18]));
            }

            //Add Percentage Payment Type - use table 13
            if (IsValidPayment(serviceTypeDataSet.Tables[13], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypePercentageChargeRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[13]));
            }

            //Add Payment Type Per Visit - use table 15
            if (IsValidPayment(serviceTypeDataSet.Tables[15], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypePerVisitRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[15]));
            }

            //Add Payment Type Medicare Lab Fee Schedule - use table 19
            if (IsValidPayment(serviceTypeDataSet.Tables[19], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeMedicareLabFeeScheduleRepository.GetPaymentType(contractServiceTypeId,
                                                                                            serviceTypeDataSet.Tables[19]));
            }

            //Add Medicare IP Payment Type - use table 10
            if (IsValidPayment(serviceTypeDataSet.Tables[10], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeMedicareIpRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[10]));
            }

            //Add Medicare OP Payment Type - use table 11
            if (IsValidPayment(serviceTypeDataSet.Tables[11], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeMedicareOPRepository.GetPaymentType(contractServiceTypeId, serviceTypeDataSet.Tables[11]));
            }

            //Add Stop loss Payment Type - use table 16
            if (IsValidPayment(serviceTypeDataSet.Tables[16], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeStopLossRepository.GetPaymentType(null, contractServiceTypeId, serviceTypeDataSet.Tables[16]));
            }

            //Add Cap Payment Type - use table 7
            if (IsValidPayment(serviceTypeDataSet.Tables[7], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeCapRepository.GetPaymentType(null, contractServiceTypeId, serviceTypeDataSet.Tables[7]));
            }

            //Add Lesser OF/Greater Of.
            if (IsValidPayment(serviceTypeDataSet.Tables[20], contractServiceTypeId))
            {
                paymentTypes.Add(PaymentTypeLesserOfRepository.GetPaymentType(null, contractServiceTypeId, serviceTypeDataSet.Tables[20]));
            }

            GetBaseConditions(serviceTypeConditions, paymentTypes);
            return(paymentTypes);
        }