/// <summary>
        /// Initializes categories in the background.
        /// </summary>
        /// <param name="continuationTaskScheduler">The task scheduler that should be used for the continuation.
        /// This should usually be the scheduler of the UI thread.</param>
        private void InitializeCategoriesAsync(TaskScheduler continuationTaskScheduler)
        {
            IsAdornerVisible = true;
            Entities.Categories categories = null;
            var task = new Task(() =>
            {
                categories = _categoryRepository.GetCategories();
            });

            task.ContinueWith(
                x =>
            {
                _seriesSelectionVM = _dependencyComposer.GetExportedValue <ISeriesSelectionVM>();
                _seriesSelectionVM.Initialize(categories.Series, TextFilter);

                _showSelectionVM = _dependencyComposer.GetExportedValue <IShowSelectionVM>();
                _showSelectionVM.Initialize(categories.Shows, TextFilter);

                _tagSelectionVM = _dependencyComposer.GetExportedValue <ITagSelectionVM>();
                _tagSelectionVM.Initialize(categories.Tags, TextFilter);

                CurrentContent = _tagSelectionVM;

                IsAdornerVisible = false;
                CommandManager.InvalidateRequerySuggested();
            },
                continuationTaskScheduler);

            task.Start();
        }
        public async Task <CategoriesReponseModel> CreateAsync(CreateCategoriesRequestModel createCategoriesRequestModel)
        {
            const string actionName = nameof(CreateAsync);

            createCategoriesRequestModel = createCategoriesRequestModel ?? throw new ArgumentNullException(nameof(createCategoriesRequestModel));

            var seoTitle = FriendlyUrlHelper.GetFriendlyTitle(createCategoriesRequestModel.Name);

            Logger.LogInfomation(LoggingMessage.ProcessingInService, actionName, seviceName, createCategoriesRequestModel);
            // var category = _Mapper.Map<Entities.Categories>(createCategoriesRequestModel);

            var category = new Entities.Categories()
            {
                Name     = createCategoriesRequestModel.Name,
                ParentId = createCategoriesRequestModel.ParentId,
                SeoTitle = seoTitle,
                Status   = createCategoriesRequestModel.Status
            };

            //if (createCategoriesRequestModel.Status != Enums.Status.Active && createCategoriesRequestModel.Status != Enums.Status.InActive)
            //    throw new NotFoundException(nameof(createCategoriesRequestModel));

            var response = await _categoryRepository.CreateAsync(category, true);

            Logger.LogInfomation(LoggingMessage.ActionSuccessfully, actionName, seviceName, response);

            return(_Mapper.Map <CategoriesReponseModel>(response));
        }