private async void transitionToSaving(AnchorVisual visual)
        {
            Log.Debug("ASADemo:", "transition to saving");
            currentStep = DemoStep.Saving;
            enableCorrectUIControls();
            Log.Debug("ASADemo", "creating anchor");
            CloudSpatialAnchor cloudAnchor = new CloudSpatialAnchor();

            visual.SetCloudAnchor(cloudAnchor);
            cloudAnchor.LocalAnchor = visual.LocalAnchor;
            try
            {
                var anchor = await cloudAnchorManager.CreateAnchorAsync(cloudAnchor);

                String anchorId = anchor.Identifier;
                Log.Debug("ASADemo:", "created anchor: " + anchorId);
                visual.SetColor(savedColor);
                anchorVisuals[anchorId] = visual;
                anchorVisuals.Remove("");

                Log.Debug("ASADemo", "recording anchor with web service");
                AnchorPoster poster = new AnchorPoster(SharingAnchorsServiceUrl);
                Log.Debug("ASADemo", "anchorId: " + anchorId);
                var result = await poster.PostAnchorAsync(anchorId);

                anchorPosted(result);
            }
            catch (System.Exception ex)
            {
                string exceptionMessage = (ex is CloudSpatialException cse) ? cse.ErrorCode.ToString() : ex.Message;
                createAnchorExceptionCompletion(exceptionMessage);
                visual.SetColor(failedColor);
            }
        }
        private void renderLocatedAnchor(CloudSpatialAnchor anchor)
        {
            AnchorVisual foundVisual = new AnchorVisual(anchor.LocalAnchor);

            foundVisual.SetCloudAnchor(anchor);
            foundVisual.AnchorNode.SetParent(arFragment.ArSceneView.Scene);
            String cloudAnchorIdentifier = foundVisual.CloudAnchor.Identifier;

            foundVisual.SetColor(foundColor);
            foundVisual.Render(arFragment);
            anchorVisuals[cloudAnchorIdentifier] = foundVisual;
        }
        private void setupLocalCloudAnchor(AnchorVisual visual)
        {
            CloudSpatialAnchor cloudAnchor = new CloudSpatialAnchor();

            cloudAnchor.LocalAnchor = visual.LocalAnchor;
            visual.SetCloudAnchor(cloudAnchor);

            // In this sample app we delete the cloud anchor explicitly, but you can also set it to expire automatically
            Date     now = new Date();
            Calendar cal = Calendar.Instance;

            cal.Time = now;
            cal.Add(CalendarField.Date, 7);
            Date oneWeekFromNow = cal.Time;

            cloudAnchor.Expiration = oneWeekFromNow;
        }
        private void anchorLookedUp(String anchorId)
        {
            Log.Debug("ASADemo", "anchor " + anchorId);
            this.anchorId = anchorId;
            destroySession();

            cloudAnchorManager = new AzureSpatialAnchorsManager(sceneView.Session);
            cloudAnchorManager.AnchorLocated += (s, e) =>
                                                RunOnUiThread(() =>
            {
                CloudSpatialAnchor anchor = e.P0.Anchor;
                if (e.P0.Status == LocateAnchorStatus.AlreadyTracked || e.P0.Status == LocateAnchorStatus.Located)
                {
                    AnchorVisual foundVisual = new AnchorVisual(anchor.LocalAnchor);
                    foundVisual.SetCloudAnchor(anchor);
                    foundVisual.AnchorNode.SetParent(arFragment.ArSceneView.Scene);
                    String cloudAnchorIdentifier = foundVisual.CloudAnchor.Identifier;
                    foundVisual.SetColor(foundColor);
                    foundVisual.Render(arFragment);
                    anchorVisuals[cloudAnchorIdentifier] = foundVisual;
                }
            });


            cloudAnchorManager.LocateAnchorsCompleted += (s, e) =>
            {
                currentStep = DemoStep.Choosing;

                RunOnUiThread(() =>
                {
                    textView.Text = "Anchor located!";
                    enableCorrectUIControls();
                });
            };
            cloudAnchorManager.Start();
            AnchorLocateCriteria criteria = new AnchorLocateCriteria();

            criteria.SetIdentifiers(new string[] { anchorId });
            cloudAnchorManager.StartLocating(criteria);
        }