if (workspaceID != null)
{
try
{
// load the workspace item
WorkspaceItem wi = WorkspaceItem.find(context, Integer
.parseInt(workspaceID));
//load submission information
SubmissionInfo si = SubmissionInfo.load(request, wi);
//TD: Special case - If a user is resuming a submission
//where the submission process now has less steps, then
//we will need to reset the stepReached in the database
//(Hopefully this will never happen, but just in case!)
if(getStepReached(si) >= si.getSubmissionConfig().getNumberOfSteps())
{
//update Stage Reached to the last step in the Process
int lastStep = si.getSubmissionConfig().getNumberOfSteps()-1;
wi.setStageReached(lastStep);
//flag that user is on last page of last step
wi.setPageReached(AbstractProcessingStep.LAST_PAGE_REACHED);
//commit all changes to database immediately
wi.update();
context.commit();
//update submission info
si.setSubmissionItem(wi);
}