public void Add(ForumThread item)
        {
            item.UrlName         = UrlHelpers.ConvertToUrl(item.Title);
            item.CreatedDateTime = DateTime.UtcNow;
            item.CreatedBy       = 1;
            var entity = _mapper.Map <Domain.Forums.ForumThreadEntity>(item);

            _forumThreadRepository.Add(entity);
        }
        public async Task <IActionResult> CreateThread(CreateThreadDTO dto)
        {
            // TEMP CODE: Check email and get userid based on it
//            var user = await _userRepo.GetByEmail(dto.UserEmail);
//            if (user != null)
//            {
            var thread = Data.Domain.Entities.Forum.Thread.Create(dto.Name, dto.Description, new Guid(HttpContext.Session.GetString("user_id")), dto.CategoryId);
            await _threadRepo.Add(thread);

            await _threadRepo.Save();

            return(RedirectToAction("Category", "Forum", new { id = dto.CategoryId }));

//            }
//            ModelState.AddModelError("", "TEMPCODE: Account doesn't exist!");

            // Something went bad, return dto back to view
            return(View(dto));
        }