public IActionResult CreateNewsSource(AddSourceVM sourceVM)
        {
            // Find the identity user
            var user = _userSettingRepo.Read(User.Identity.Name);
            // Find the user's associated news category
            var category = user.UserSettingNewsCategories.FirstOrDefault(u => u.NewsCategory.Name == sourceVM.CategoryName);

            // When both are undefined, return the user to the profile/index
            if (category == null || user == null)
            {
                return(RedirectToAction("Index", "Profile"));
            }

            // When the state of the model is valid
            if (ModelState.IsValid)
            {
                // Iterate over each news source
                foreach (var source in sourceVM.NewsSources)
                {
                    // Create the news source
                    _newsCategoryRepo.CreateNewsSource(source, category);
                }
                return(RedirectToAction("AddNewsSource", "Profile", new { id = category.Id }));
            }

            return(View(sourceVM));
        }
        /// <summary>
        /// Displays a add news source view.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>View</returns>
        public IActionResult AddNewsSource(int id)
        {
            // Find the category from the supplied ID
            var category = _newsCategoryRepo.ReadUserSettingNewsCategory(id);
            // Find the identity user
            var user = _userSettingRepo.Read(User.Identity.Name);

            // When both are undefined, redirect the user to the index
            if (category == null || user == null)
            {
                return(RedirectToAction("Index", "Profile"));
            }

            // Instantiate a new add source view model
            var sourceVM = new AddSourceVM
            {
                ExistingNewSources      = category.NewsSources,
                UserSettingNewsCategory = category,
                CategoryName            = category.NewsCategory.Name,
                CategoryId = category.Id,
                Language   = user.Language,
                Country    = user.Country
            };

            return(View(sourceVM));
        }