private static List <Provider> SetProvidersFromReader(SqlDataReader reader) { var providerList = new List <Provider>(); if (reader.HasRows) { while (reader.Read()) { providerList.Add(new Provider { npi = reader["NPI"].ToString(), name = new ProviderName { first = reader["FIRSTNAME"].ToString(), middle = reader["MIDDLENAME"].ToString(), last = reader["LASTNAME"].ToString(), suffix = String.IsNullOrEmpty(reader["SUFFIX"].ToString()) ? null : reader["Suffix"].ToString() }, address = new Address { address = reader["LINE1"].ToString(), address_2 = reader["LINE2"].ToString(), city = reader["CITY"].ToString(), state = reader["STATE"].ToString(), zip = reader["ZIP"].ToString() }, specialty = new List <string> { EnumUtility.Convert( (DentalProviderSpecialty)Enum.Parse(typeof(DentalProviderSpecialty), reader["PROVIDERSPECIALTY"].ToString())) }, phone = reader["PHONENUMBER"].ToString(), networks = reader["NETWORK"].ToString(), network_type = reader["NETWORKTYPE"].ToString(), import_type = reader["IMPORTTYPE"].ToString(), accepting = Boolean.Parse(reader["NEWPATIENTS"].ToString()), last_updated_on = DateTime.Today.ToString("yyyy-MM-dd") }); } } return(providerList); }