public async Task <NewsCategory> EditCategoryAsync(NewsCategory category)
        {
            VerifyManagementPermission();

            var currentCategory = await _newsCategoryRepository.GetByIdAsync(category.Id);

            currentCategory.Name = category.Name.Trim();

            return(await _newsCategoryRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId),
                                                                 currentCategory));
        }
        public async Task <NewsCategory> EditCategoryAsync(NewsCategory category)
        {
            VerifyManagementPermission();

            if (category == null)
            {
                throw new GraException("You must provide a category to edit.");
            }

            var currentCategory = await _newsCategoryRepository.GetByIdAsync(category.Id);

            currentCategory.Name = category.Name.Trim();

            return(await _newsCategoryRepository.UpdateSaveAsync(GetClaimId(ClaimType.UserId),
                                                                 currentCategory));
        }