public static Post CreateNewEntity(PostModel postModel, User author, BloggingSystemContext context)
        {
            Post postEntity = new Post()
            {
                Title = postModel.Title,
                Author = author,
                PostDate = DateTime.Now,
                Text = postModel.Text
            };

            foreach (var tagName in postModel.Tags)
            {
                postEntity.Tags.Add(Extensions.CreateOrLoadTag(tagName.ToLower(), context));
            }

            var titleTags = postModel.Title.Split(WordSeparators, StringSplitOptions.RemoveEmptyEntries);
            foreach (var titleTagName in titleTags)
            {
                if (titleTagName.Length > 1)
                {
                    postEntity.Tags.Add(Extensions.CreateOrLoadTag(titleTagName.ToLower(), context));
                }
            }

            return postEntity;
        }
        public static UserLoggedModel ToModel(User userEntity)
        {
            UserLoggedModel userLoggedModel = new UserLoggedModel()
            {
                DisplayName = userEntity.DisplayName,
                SessionKey = userEntity.SessionKey
            };

            return userLoggedModel;
        }
        public static User ToEntity(UserRegisterModel userModel)
        {
            User userEntity = new User()
            {
                Username = userModel.Username.ToLower(),
                DisplayName = userModel.DisplayName,
                AuthCode = userModel.AuthCode
            };

            return userEntity;
        }
        public static Comment ToEntity(CommentModel commentModel, User author)
        {
            Comment commentEntity = new Comment()
            {
                Author = author,
                PostDate = DateTime.Now,
                Text = commentModel.Text
            };

            return commentEntity;
        }