public void CommentAProcess() { processLogger.UserInput("Give me the process Id you want to comment : "); bool userInputId = Int32.TryParse(Console.ReadLine(), out int inputId); if (userInputId) { var confirmprocess = allMyProcess.Where(process => process.ItemId == inputId); processLogger.UserInput("Give me the comment : "); string comment = Console.ReadLine(); foreach (var element in confirmprocess) { element.Comment = comment; } } else { throw new ArgumentException("Invalid argument"); } }