public ICollection <PostItemViewModel> GetItems(int count) { var model = new Collection <PostItemViewModel>(); var posts = postDao.Load(0, count); if (posts == null) { logger.Error("PostDao returned null;"); return(model); } foreach (var post in posts) { int commentsCount; var comments = commentDao.LoadByPostTitle(post.Title); if (comments == null) { logger.Error("CommentDao returned null;"); commentsCount = 0; } else { commentsCount = comments.Count(); } model.Add(new PostItemViewModel(post.Title, ExtractShortSummary(post), post.DateCreated, commentsCount)); } return(model); }