Select serviceid from dorgtoservice where orgID = #URL.Orgid# Delete from dOrgtoService where OrgID =#URL.orgid# and ServiceID = #OtherServiceArray[x]# delete from dOrgToService Where OrgID = #URL.ORGID# Insert Into dOrgtoService (OrgID, ServiceID) Values(#URL.OrgID#, #Array[x]#) Insert into dService(Service,Type, Approved,CenterID) Values('#form.Other1#','Expertise',1,6) Select Max(serviceid) as maxSid from dService Insert into dOrgtoService (OrgID, ServiceID) Values(#URL.OrgID#, #getMaxServiceid.maxSid#) Insert into dService(Service,Type, Approved,CenterID) Values('#form.Other2#','Resources',1,6) Select Max(serviceid) as maxSid from dService Insert into dOrgtoService (OrgID, ServiceID) Values(#URL.OrgID#, #getmaxServiceID.maxSid#) Insert into dService(Service,Type, Approved,CenterID) Values('#form.Other3#','Clients',1,6) Select Max(serviceid) as maxSid from dService Insert into dOrgtoService (OrgID, ServiceID) Values(#URL.OrgID#, #getMaxServiceID.maxSid#)