Make Record Inactivate using C# in CRM 2011

//Inactive Recordes C#

public bool InactiveRecord ( string entity, Guid id )
{
try{
SetStateRequest req = new SetStateRequest();

//the entity you want to change the state of
req.EntityMoniker = new EntityReference(entity,id);

//what should the new state be\
req.State = new OptionSetValue((int)AccountState.Inactive);

//Pick an option from the status reason picklist to specify reason for state change
req.Status = new OptionSetValue (2);

this.Service.Execute (req);
return true;

}
catch ( SoapException ex ){
return false;
}
}