public int GetProductId(IRepositoryFactory repositoryFactory) { bool correctInput = true; string userInput; int id = -1; Console.WriteLine("Enter product ID: "); do { IsWrongInput(correctInput); try { userInput = Console.ReadLine(); id = int.Parse(userInput); correctInput = ValidateInput.IsCorrectProductId(id, repositoryFactory, correctInput); } catch (Exception) { correctInput = false; } }while (!correctInput); return(id); }