public ServerResult UploadConspect([FromBody] UploadConspectArgs args)
 {
     return _service.UploadConspect(args);
 }
        public ServerResult UploadConspect(UploadConspectArgs args)
        {
            try
            {
                if (args == null)
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = "Failed to get argument object"
                           }
                }
                ;

                if (args.UserId == 0)
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = "UserId required"
                           }
                }
                ;

                var user = _usersService.GetUserBasic(args.UserId);
                if (user == null)
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = $"User with id {args.UserId} not found"
                           }
                }
                ;

                if (string.IsNullOrWhiteSpace(args.Title))
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = "Title required"
                           }
                }
                ;

                if (args.CategoryId == 0)
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = "CategoryId required"
                           }
                }
                ;

                var category = _categoriesService.GetById(args.CategoryId);
                if (category == null)
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = $"Category with id {args.CategoryId} not found"
                           }
                }
                ;

                if (args.Content == null)
                {
                    return new ServerResult
                           {
                               Success = false,
                               Message = "Content required"
                           }
                }
                ;

                if (args.ParentId.HasValue)
                {
                    var parentConspect = _repository.GetById(args.ParentId.Value);

                    if (parentConspect == null)
                    {
                        return new ServerResult
                               {
                                   Success = false,
                                   Message = $"Parent conspect with id {args.ParentId.Value} not found"
                               }
                    }
                    ;
                }

                var conspectId = _repository.UploadConspect(new conSpektas.Data.Entities.Conspect
                {
                    UserId   = user.Id,
                    Title    = args.Title,
                    ParentId = args.ParentId,
                    Content  = args.Content,
                    Inserted = DateTime.Now
                });

                _categoriesService.Insert(new conSpektas.Data.Entities.ConspectCategory
                {
                    ConspectId = conspectId,
                    CategoryId = category.Id,
                });

                return(new ServerResult {
                    Success = true
                });
            }
            catch (Exception exc)
            {
                return(new ServerResult
                {
                    Success = false,
                    Message = exc.Message
                });
            }
        }