Hi Chamara,
Are you sure that the line statusID = item.StatusID;
is executed?
Also, order statuses can be global and internal. So maybe you have "InProgress" status in globals and don't have it in your store.
Links:
Order statuses
Multisite store
Enabling global E-commerce objects