public AddCategoryResult Save([FromBody] SaveCategoryRequest request)
        {
            try
            {
                if (request == null || request.Category == null)
                {
                    throw new ArgumentNullException(nameof(SaveCategoryRequest));
                }

                // Check if the current user is authorized to make this operation
                else
                {
                    CategoryManager.CheckIsUserAuthonticatedToEditDelete(User.GetUserId(), request.Category);
                }

                if (request.Category.IconName.CheckIsNull())
                {
                    request.Category.IconName = Guid.NewGuid().ToString();
                }
                CategoryManager.Add(request.Category);

                if (request.Category.Icon != null && request.Category.Icon.Length > 0)
                {
                    ImageExtensions.SaveImage(GetCategoryImagePath(request.Category.IconName), request.Category.Icon);
                }

                return(new AddCategoryResult()
                {
                });
            }
            catch (Exception ex)
            {
                return(new AddCategoryResult(ex));
            }
        }
        public AddNewsResult Save([FromBody] SaveNewsRequest addrequest)
        {
            try
            {
                if (addrequest == null || addrequest.News == null)
                {
                    throw new ArgumentNullException(nameof(SaveNewsRequest));
                }

                CategoryDTO newsCategory = CategoryManager.GetByID(addrequest.News.CategoryId);
                CategoryManager.CheckIsUserAuthonticatedToEditDelete(User.GetUserId(), newsCategory);

                // Check if the current user is authorized to make this operation
                if (!addrequest.News.Id.HasValue)
                {
                    addrequest.News.CreateUser = User.GetUserId();
                }
                else
                {
                    NewsManager.CheckIsUserAuthonticatedToEditDelete(User.GetUserId(), addrequest.News);
                }

                if (addrequest.News.IconName.CheckIsNull())
                {
                    addrequest.News.IconName = Guid.NewGuid().ToString();
                }
                NewsManager.Save(addrequest.News);

                if (addrequest.News.Icon != null && addrequest.News.Icon.Length > 0)
                {
                    ImageExtensions.SaveImage(GetNewsImagePath(addrequest.News.IconName), addrequest.News.Icon);
                }

                return(new AddNewsResult()
                {
                });
            }
            catch (Exception ex)
            {
                return(new AddNewsResult(ex));
            }
        }