public string GetElementName() { bool nameSelection = true; string elementName = ""; while (nameSelection) { nameSelection = false; Console.Write("Element name: "); elementName = Console.ReadLine(); Console.Clear(); List <Element> loadedElements = new JsonFileManager().LoadElements("../../../../AppData/Elements.json"); if (loadedElements != null && loadedElements.Any()) { foreach (Element element in new JsonFileManager().LoadElements("../../../../AppData/Elements.json")) { if (element.Name == elementName) { nameSelection = true; Console.WriteLine("This element already exist"); } } } } return(elementName); }