public SupplierInvoiceSplit RemoveSupplierFormInvoiceNumber(string InvoiceNumberWithSupplier, List<string> Suppliers) { SupplierInvoiceSplit ins = new SupplierInvoiceSplit(); SupplierRepository suprep = new SupplierRepository(); foreach(string supplier in Suppliers) { if(InvoiceNumberWithSupplier.Contains(supplier)) { InvoiceNumberWithSupplier = InvoiceNumberWithSupplier.Replace((" " + supplier), ""); ins.InvoiceNumber = InvoiceNumberWithSupplier; ins.SupplierId = suprep.GetSupplier(supplier).SupplierID; } } return ins; }