public static bool TryBuild(this NewContentViewModel vm,
                                    TagResolver resolver,
                                    Domain domain,
                                    IEnumerable <MimeMapViewModel> mimes,
                                    ContentManager contentManager,
                                    out ContentItem item)
        {
            bool b = vm.Validate();

            item = new ContentItem();
            var contentType = vm.ContentType;

            if (b)
            {
                b            = !b;
                item.Id      = Guid.NewGuid().ToString().ToLower();
                item.Display = vm.Display;
                item.Scope   = vm.Scope;
                item.Properties.DefaultTags(domain);
                item.Properties.AddRange(resolver.Resolve(vm.Tags));
                if (vm.HasFile)
                {
                    FileInfo info = new FileInfo(vm.Filepath);
                    if (contentManager.TryInload(info, out string filename))
                    {
                        item.Mime = mimes.Resolve(info);
                        item.Body = filename;
                        item.Properties.Add(new Property()
                        {
                            Name  = $"{AppConstants.Tags.Prefix}-{AppConstants.Tags.Extension}",
                            Value = item.Mime
                        });
                        var filetype = item.Mime.Trim(new char[] { '.' });
                        vm.Paths.Add($"/files/{filetype}");
                        b = true;
                    }
                }
                else
                {
                    item.Mime = vm.Mime;
                    if (vm.IsLink)
                    {
                        if (!vm.Body.StartsWithAny(new string[] { "http://", "https://" }))
                        {
                            item.Body = $"http://{vm.Body}";
                        }
                        else
                        {
                            item.Body = vm.Body;
                        }
                    }
                    else if (vm.Body.Length > contentManager.MaxLength &&
                             contentManager.TryInloadAsFile(vm.Body, item.Id, out string filename, out FileInfo info))
                    {
                        item.Mime = mimes.Resolve(info);
                        item.Body = filename;
                        item.Properties.Add(new Property()
                        {
                            Name  = $"{AppConstants.Tags.Prefix}-{AppConstants.Tags.Extension}",
                            Value = item.Mime
                        });
                        b = true;
                    }
                    else
                    {
                        item.Body = vm.Body;
                    }

                    b = true;
                }
 public static Domain Default(this Domain model, DateTime now)
 {
     return(model.Default(now, AppConstants.Default));
 }