private IEnumerable <Person> ParsePeople(string input) { var person = new Person(); using (StringReader reader = new StringReader(input)) { string line; int linesPerPerson = 0; while ((line = reader.ReadLine()) != null || linesPerPerson > 0) { if (!string.IsNullOrEmpty(line)) { var keyValue = parserService.ParseKeyValuePair(line); mapper.AddPersonAttributeToPerson(keyValue, person); linesPerPerson++; } else { yield return(person); linesPerPerson = 0; } } } }