See the complete post on this topic on the ArcGIS Developer blog.