public IActionResult Edit()
        {
            var speaker = GetLoggedInUser();

            // Sanity check
            if (speaker == null)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            // Create our ViewModel and fire up the View!
            var speakerViewModel = new SpeakerEditViewModel(speaker);


            return(View(speakerViewModel));
        }
        public IActionResult Edit(SpeakerEditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                // Something wasn't valid, send them back
                return(View(viewModel));
            }

            // Rehydrate the model object and then append on top our changes
            var speaker = GetLoggedInUser();

            // Sanity check
            if (speaker == null)
            {
                ModelState.AddModelError(string.Empty, "Error locating your Speaker profile from the database.");
                return(View(viewModel));
            }

            // Append on top the changes
            speaker.FirstName           = viewModel.FirstName;
            speaker.LastName            = viewModel.LastName;
            speaker.Username            = GetUsername();
            speaker.Bio                 = viewModel.Bio;
            speaker.Photo               = viewModel.Photo;
            speaker.BlogUri             = viewModel.BlogUri;
            speaker.TwitterHandle       = viewModel.TwitterHandle;
            speaker.LinkedInProfile     = viewModel.LinkedInProfile;
            speaker.FacebookProfile     = viewModel.FacebookProfile;
            speaker.SpeakerInfo.Tagline = viewModel.Tagline;

            // Actually save this model data!
            _speakerService.SaveSpeaker();

            // Redirect back to Index()
            return(RedirectToAction("Index"));
        }