public void ValidateLogin(string username, string password)
        {
            Console.WriteLine("Validating log in");
            if (string.IsNullOrEmpty(username))
            {
                throw new Exception("Enter username");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new Exception("Enter password");
            }

            ClaimsIdentity identity = new ClaimsIdentity();

            try {
                User user = userData.CheckUser(username, password).Result;
                identity = SetupClaimsForUser(user);
                string serialisedData = JsonSerializer.Serialize(user);
                jsRuntime.InvokeVoidAsync("sessionStorage.setItem", "currentUser", serialisedData);
                cachedUser = user;
            } catch (Exception e) {
                throw e;
            }

            NotifyAuthenticationStateChanged(
                Task.FromResult(new AuthenticationState(new ClaimsPrincipal(identity))));
        }