void ReleaseDesignerOutlets()
        {
            if (SessionsCollectionView != null)
            {
                SessionsCollectionView.Dispose();
                SessionsCollectionView = null;
            }

            if (SessionsInstructions != null)
            {
                SessionsInstructions.Dispose();
                SessionsInstructions = null;
            }

            if (SessionsInstructionsBody != null)
            {
                SessionsInstructionsBody.Dispose();
                SessionsInstructionsBody = null;
            }

            if (SessionsUpload != null)
            {
                SessionsUpload.Dispose();
                SessionsUpload = null;
            }
        }
        // Index is optional such that the method could be used onSelected(item)
        public async void UploadSessions(int index, bool recursive)
        {
            var sessions = SessionsViewSource.Sessions;

            // Out of bounds validation
            if (sessions.ElementAtOrDefault(index) == null)
            {
                return;
            }

            // Update attribute so when item is reloaded the indicator will animate.
            sessions[index].IsUploading = true;
            var item = NSIndexPath.FromIndex((uint)Sessions.IndexOf(sessions[index]));

            SessionsCollectionView.ReloadItems(new NSIndexPath[] { item });
            Logger.LOG_EVENT_WITH_ACTION("UPLOAD_SESSION", "ATTEMPT");
            // TODO: creating a new instance of API for each view, urgh.
            var didUpload = await new RestClient().Upload(sessions[index]);

            if (didUpload)
            {
                Logger.LOG_EVENT_WITH_ACTION("UPLOAD_SESSION", "SUCCESS");
                sessions[index].IsUploaded = true;
                // Update state so the session isnt shown on reload etc.
                Session.Connection.Update(sessions[index]);
                sessions.Remove(sessions[index]);
                SessionsCollectionView.ReloadData();
                PresentViewController(new MessageDialog().BuildErrorMessageDialog(
                                          StringResources.sessions_ui_message_upload_success, ""), true, null);
                // Try to upload the next session
                if (recursive)
                {
                    UploadSessions(0, true);
                }
            }
            else
            {
                Logger.LOG_EVENT_WITH_ACTION("UPLOAD_SESSION", "ERROR");
                // Stop spining
                sessions[index].IsUploading = false;
                SessionsCollectionView.ReloadItems(new NSIndexPath[] { item });
                PresentViewController(
                    new MessageDialog().BuildErrorMessageDialog(
                        StringResources.sessions_ui_message_upload_fail, ""), true, null);
            }
            if (Sessions.Count <= 0)
            {
                ShowHideInstructions();
            }
        }
        // Index is optional such that the method could be used onSelected(item)
        public async Task UploadSessions(int index, bool recursive)
        {
            var sessions = SessionsViewSource.Sessions;

            // Out of bounds validation
            if (sessions.ElementAtOrDefault(index) == null)
            {
                return;
            }

            SessionsViewSource.SessionIsUploading(index);
            SessionsCollectionView.ReloadData();
            Logger.LOG_EVENT_WITH_ACTION("UPLOAD_SESSION", "ATTEMPT");

            var didUpload = await RestClient.Upload(sessions[index]);

            if (didUpload)
            {
                Logger.LOG_EVENT_WITH_ACTION("UPLOAD_SESSION", "SUCCESS");
                SessionsViewSource.SessionIsUploaded(index);
                SessionsCollectionView.ReloadData();

                TrackWaitingUploads();

                Session.ActiveUser.NumUploaded++;
                Queries.SaveActiveUser();

                Analytics.SetUserProperty("numUploaded", Session.ActiveUser.NumUploaded.ToString());

                var prefs = NSUserDefaults.StandardUserDefaults;
                if (!prefs.BoolForKey("SHOWN_FIRSTUPLOAD"))
                {
                    // Show pop-up explaining viewing uploaded data and changing consent
                    PerformSegue("FirstUploadModal", this);
                }
                else
                {
                    PresentViewController(new MessageDialog().BuildErrorMessageDialog(
                                              StringResources.sessions_ui_message_upload_success, ""), true, null);
                    // Try to upload the next session
                    if (recursive)
                    {
                        UploadSessions(0, true);
                    }
                }
            }
            else
            {
                Logger.LOG_EVENT_WITH_ACTION("UPLOAD_SESSION", "ERROR");
                SessionsViewSource.SessionUploadFail(index);
                SessionsCollectionView.ReloadData();

                PresentViewController(
                    new MessageDialog().BuildErrorMessageDialog(
                        StringResources.sessions_ui_message_upload_fail, ""), true, null);
            }
            // TODO: this should be done on UI; modify enabled color, obviously.
            SessionsUpload.Enabled         = true;
            SessionsUpload.BackgroundColor = UIColor.White;
            if (Sessions.Count <= 0)
            {
                ShowHideInstructions();
            }
        }