Replaced static counter id with ObjectId from db.

The static counter id would fail since it is reset evry time the server
restarts. Using the db ObjectId ensures a globally uniq Id for the
objects.