public virtual bool TryCreatePreview(ref PreviewEntity ent, string model) { if (!ent.IsValid()) { ent = new PreviewEntity(); ent.SetModel(model); } if (Previews == null) { Previews = new List <PreviewEntity>(); } if (!Previews.Contains(ent)) { Previews.Add(ent); } return(ent.IsValid()); }