Added pessemistic locking in the rest service for adding a post.