insertBlogPost :: BlogPost -> DB.Pipe -> IO ()
insertBlogPost blogPost pipe = do
  bDateTime <- getDateTimeAsString
  let updatedBlogPost = updateDateTimeInBlogPost bDateTime blogPost
  DB.access pipe DB.master "blogPosts" (run updatedBlogPost)
  return ()
  where
    run updatedBlogPost = DB.insert "blogPosts" (blogPostToDocument updatedBlogPost)

-- Spock Actions
insertBlogPost :: BlogPost -> DB.Pipe -> IO ()
insertBlogPost blogPost pipe = do
  bDateTime <- getDateTimeAsString
  let updatedBlogPost = updateDateTimeInBlogPost bDateTime blogPost
  DB.access pipe DB.master "blogPosts" (run updatedBlogPost)
  return ()
  where
    run updatedBlogPost = DB.insert "blogPosts" (blogPostToDocument updatedBlogPost)

-- Spock Actions
insertBlogPost blogPost pipe = do
  bDateTime <- getDateTimeAsString
  let updatedBlogPost = updateDateTimeInBlogPost bDateTime blogPost
  DB.access pipe DB.master "blogPosts" (run updatedBlogPost)
  return ()
  where
    run updatedBlogPost = DB.insert "blogPosts" (blogPostToDocument updatedBlogPost)

-- Spock Actions