Moves objectId validation into middleware