public void BuildClient()
        {
            Client.Builder cb = new Client.Builder(appKey, appSecret)
                                .setFilePath(NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User)[0].ToString())
                                .setOfflinePlatform(new SQLitePlatformIOS())
                                .setLogger(delegate(string msg)
            {
                Console.WriteLine(msg);
            });

            cb.Build();

            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            if (Client.SharedClient.IsUserLoggedIn())
            {
                var alreadyLoggedInController = new PatientViewController();
                var navController             = new UINavigationController(alreadyLoggedInController);
                Window.RootViewController = navController;
            }
            else
            {
                vc = new LoginViewController();
                var navController = new UINavigationController(vc);
                Window.RootViewController = navController;
            }

            // make the window visible
            Window.MakeKeyAndVisible();
        }
        public async Task Logout()
        {
            //await stream.Unsubscribe(Client.SharedClient.ActiveUser.Id);
            Client.SharedClient?.ActiveUser?.UnregisterRealtimeAsync();
            Client.SharedClient?.ActiveUser?.Logout();
            var logInController = new LoginViewController();
            var navController   = new UINavigationController(logInController);

            Window.RootViewController = navController;
        }