public async Task <ActionResult> Create(CreateStoryRequestModel model)
        {
            var loggedUser = this.User.GetId();
            var result     = await this.storyService.CreateStoryAsync(model, loggedUser);

            if (!result.Success)
            {
                return(BadRequest(result.Errors));
            }

            return(Created(nameof(Create), result));
        }
        public async Task <ResultModel <string> > CreateStoryAsync(CreateStoryRequestModel model, string userId)
        {
            var author = await this.dbContext
                         .Users
                         .Where(u => u.Id == userId && !u.IsDeleted)
                         .FirstOrDefaultAsync();

            if (author == null)
            {
                return(new ResultModel <string>
                {
                    Errors = { UserErrors.InvalidUserId }
                });
            }
            var isBanned = await this.userService.IsBanned(userId);

            if (isBanned)
            {
                return(new ResultModel <string>
                {
                    Errors = { UserErrors.BannedUserCreateStory }
                });
            }

            var story = new Story
            {
                Title      = model.Title,
                Content    = model.Content,
                PictureUrl = model.PictureUrl,
                Rating     = 0,
                UserId     = userId,
            };

            await this.dbContext.Stories.AddAsync(story);

            await this.dbContext.SaveChangesAsync();

            await this.storyCategoriesService.CreateAsync(story.Id, model.Categories);

            return(new ResultModel <string>
            {
                Result = story.Id,
                Success = true,
            });
        }