public async Task <DeleteRespObj> Handle(DeleteSupplierTopSupplierCommand request, CancellationToken cancellationToken) { try { if (request.req.Count() > 0) { foreach (var itemId in request.req) { var itemToDelete = await _supRepo.GetSupplierTopSupplierAsync(itemId.TargetId); await _supRepo.DeleteSupplierTopSupplierAsync(itemToDelete); } } return(new DeleteRespObj { Deleted = true, Status = new APIResponseStatus { IsSuccessful = true, Message = new APIResponseMessage { FriendlyMessage = "Item(s) deleted succcessfully", } } }); } catch (SqlException ex) { #region Log error to file var errorCode = ErrorID.Generate(4); _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}"); return(new DeleteRespObj { Status = new APIResponseStatus { Message = new APIResponseMessage { FriendlyMessage = "Error occured!! Unable to process request", MessageId = errorCode, TechnicalMessage = $"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}" } } }); #endregion } }