public bool Create(PictureRequestModel model, string userId)
        {
            if (model == null)
            {
                throw new NullReferenceException(nameof(model));
            }

            var category = this.db.Categories.FirstOrDefault(x => x.Type == model.Type);

            if (category == null)
            {
                return(false);
            }

            var entity = Mapper.Map <Picture>(model);

            entity.OwnerId    = userId;
            entity.CategoryId = category.Id;

            this.db.Pictures.Add(entity);

            db.SaveChanges();

            return(true);
        }
        public ActionResult Create(PictureRequestModel model)
        {
            var userId = this.User.GetUserId();

            var isCreated = this.picturesService.Create(model, userId);

            if (!isCreated)
            {
                return(BadRequest());
            }

            return(Ok());
        }