public static AuthenticationFile RetrieveAuthenticationData()
        {
            AuthenticationFile AuthFile = new AuthenticationFile();
            var AuthenticationFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Lib.AUTHENTICATION_FILE_LOCATION); // Location of Authentication file
            try
            {
                if (!File.Exists(AuthenticationFilePath))
                {
                    Console.WriteLine("No authentication file found. Creating.");
                    AuthenticationFile NewAuthenticationFile = new AuthenticationFile();
                    NewAuthenticationFile.Profiles = new Dictionary<String, Profile>();

                    AuthFileManager.CreateNewAuthenticationFile(AuthenticationFilePath, NewAuthenticationFile);
                }

                String FileContents = File.ReadAllText(AuthenticationFilePath);

                AuthFile = JsonConvert.DeserializeObject<AuthenticationFile>(FileContents);

            }
            catch (JsonSerializationException)
            {
                File.Delete(AuthenticationFilePath);
            }

            return AuthFile;
        }
        /// <summary>
        /// Return all profiles from the authentication file
        /// </summary>
        /// <returns>List of profiles</returns>
        public Dictionary<String,Profile> GetProfiles()
        {
            AuthenticationDb = AuthFileManager.RetrieveAuthenticationData();

            return AuthenticationDb.Profiles;
        }
 public static void WriteAuthenticationToFile(string filePath, AuthenticationFile authFile)
 {
     string Json = JsonConvert.SerializeObject(authFile, Formatting.Indented);
     File.WriteAllText(filePath, Json);
 }
 public static void CreateNewAuthenticationFile(string filePath, AuthenticationFile authFile)
 {
     Directory.CreateDirectory(Path.GetDirectoryName(filePath));
     string Json = JsonConvert.SerializeObject(authFile, Formatting.Indented);
     File.WriteAllText(filePath, Json);
 }