private static ISoldier TryToCreateEngineer(string[] soldierInfo, string id, string firstName, string lastName) { var salary = decimal.Parse(soldierInfo[4]); var corps = soldierInfo[5]; var currentEngineer = new Engineer(id, firstName, lastName, salary, new Corps(corps)); var repairsInfo = soldierInfo.Skip(6).ToList(); for (int i = 0; i < repairsInfo.Count; i += 2) { var repairPart = repairsInfo[i]; var repairHours = int.Parse(repairsInfo[i + 1]); currentEngineer.AddRapair(new Repair(repairPart, repairHours)); } return(currentEngineer); }