public IActionResult Delete(string arrayOfID) { string[] DeserializeID = JsonConvert.DeserializeObject <string[]>(arrayOfID); int[] listID = DeserializeID.Select(s => Convert.ToInt32(EncryptionHelper.DecryptUrlParam(s))).ToArray(); try { foreach (var ID in arrayOfID) { if (_organizationUnitProvider.ValidateDelete(ID)) { return(BadRequest("Unable to delete! Selected data has been used on another menu")); } } Array.ForEach(listID, _organizationUnitProvider.Delete); } catch (Exception) { throw; } return(Ok()); }