public static string SaveChanges(string fieldName, string fromValue, string toValue, bool includeArchive, bool myData) { Dictionary <string, string> result = new Dictionary <string, string>() { { "saved", "false" } , { "Count", "0" } , { "error", "" } }; bool saved = false, proceed = true; int count = 0; string errorMsg = string.Empty; try { if (fieldName.Length == 0) { errorMsg = "No field to update was specified."; proceed = false; saved = false; count = 0; } if (toValue.Length == 0) { errorMsg = "No new value was specified."; proceed = false; saved = false; count = 0; } if (proceed) { if (fromValue.Length == 0) { //this is okay, but make sure procedure works with empty old value string msg = ""; } //save the data count = WorkloadItem.WorkItem_MassChange(fieldName: fieldName , fromValue: fromValue , toValue: toValue , includeArchive: includeArchive , myData: myData , errorMsg: out errorMsg); if (count > 0) { saved = true; } } } catch (Exception ex) { LogUtility.LogException(ex); saved = false; count = 0; errorMsg = ex.Message; } result["saved"] = saved.ToString(); result["Count"] = count.ToString(); result["error"] = errorMsg; return(JsonConvert.SerializeObject(result, Formatting.None)); }