public News UpdateFromDto(NewsDto newsDto) { if (newsDto == null) { return(this); } NewsId = newsDto.newsId; AuthorId = newsDto.authorId; Title = newsDto.title; Body = newsDto.body; Date = newsDto.date.UnixTimestampToDateTime(); Type = newsDto.type; // Not recreating list in case of situation if somoene is holding list's reference during update Likes.Clear(); Likes.AddRange(newsDto.likes); // Same thing here Comments.Clear(); if (newsDto.comments != null) { Comments.AddRange(newsDto.comments.Select(commentDto => commentDto.commentId)); } // For fluent interface purposes return(this); }