Adding records into UDCodes Table via BO

Could anyone help me to work out how to add arecord into the UDCodes table from within a Pre-Processing Method Directive. The following code does not error out and should work, but it doesn’t:

        // We need to create another UD Code record
        var bo=Ice.Assemblies.ServiceRenderer.GetService<UserCodesSvcContract>(Db);
        
        var dsCodes_Updated = bo.GetByID("NEXT");

        var oNewRow = dsCodes_Updated.UDCodes.NewRow();
        dsCodes_Updated.UDCodes.Add(oNewRow);

        dsCodes_Updated.UDCodes[0].CodeTypeID="NEXT";
        dsCodes_Updated.UDCodes[0].CodeID = cPrefix+cShort_Id;
        dsCodes_Updated.UDCodes[0].CodeDesc = string.Format("{0}",nNextCustNum+1);
        dsCodes_Updated.UDCodes[0].LongDesc = "Next Seq: ";
        
        
        // Add the new UDCodes record into the table
        bo.Update(ref dsCodes_Updated);
        bo.Dispose();

Thanks in advance