public Post CreatePostWithBlog(PostWithBlog postWithBlog) { PostDto post = null; _appContext.StartSession(); try { var blog = new BlogDto() { Url = postWithBlog.BlogUrl }; _blogRepository.Create(blog); post = new PostDto() { BlogId = blog.Id, Title = postWithBlog.Title, Content = postWithBlog.Content }; _postRepository.Create(post); _appContext.CompleteSession(); } catch { _appContext.RollbackSession(); throw; } return(_mapper.Map <Post>(post)); }