public List <ViewModel> ReadCsvFile(HttpPostedFileBase uploadFile) { //reading a excel file into data table var dataTable = _cSVReader.ExcelToDataTable(uploadFile); //validate and convert into list of valid enteries var IndividualMember = new ViewModel(); var listofValidMembers = new List <ViewModel>(); for (int i = 0; i < dataTable.Rows.Count; i++) { //used to bind the values and if the row is corrupted IndividualMember = ViewModelBinder.Bind(dataTable, i, _logger); if ((IndividualMember != null)) { listofValidMembers.Add(IndividualMember); } } return(listofValidMembers); }