Blog.Logic.ObjectMapper.CommentMapper.ToEntity C# (CSharp) Method

ToEntity() public static method

public static ToEntity ( Comment comment ) : Comment
comment Comment
return Blog.DataAccess.Database.Entities.Objects.Comment
        public static Db.Comment ToEntity(Comment comment)
        {
            if (comment != null)
            {
                var commentLikes = comment.CommentLikes != null
                   ? comment.CommentLikes.Select(CommentLikeMapper.ToEntity).ToList()
                   : null;
                var comments = comment.Comments != null
                    ? comment.Comments.Select(ToEntity).ToList()
                    : null;

                if (comment.User != null)
                    return new Db.Comment
                    {
                        CommentId = comment.Id,
                        CommentLikes = commentLikes,
                        CommentLocation = comment.CommentLocation,
                        CommentMessage = comment.CommentMessage,
                        ParentCommentId = comment.ParentCommentId,
                        PostId = comment.PostId,
                        Comments = comments,
                        User = UserMapper.ToEntity(comment.User),
                        UserId = comment.User.Id,
                        CreatedBy = comment.CreatedBy,
                        CreatedDate = comment.CreatedDate,
                        ModifiedBy = comment.ModifiedBy,
                        ModifiedDate = comment.ModifiedDate
                    };
            }
            return null;
        }
    }
CommentMapper