private static void TryParseParametersForFilterAndTake(string takeCommand, string takeQuantity, string coursename, string filter) { if (takeCommand == "take") { if (takeQuantity == "all") { StudentsRepository.FilerAndTake(coursename, filter); } else { int studentsToTake; bool hasParsed = Int32.TryParse(takeQuantity, out studentsToTake); if (hasParsed) { StudentsRepository.FilerAndTake(coursename, filter, studentsToTake); } else { OutputWriter.DisplayException(ExceptionMessages.InvalidTakeQuantityParameter); } } } else { OutputWriter.DisplayException(ExceptionMessages.InvalidTakeCommand); } }