public bool Delete(string id) { try { Tag tag = _tagRepository.Get(id); var productTagList = _productTagRepository.GetProductTagViewModelsByTagId(id).Select(s => s.Id).ToList(); if (productTagList.Count > 0) { foreach (var item in productTagList) { _productTagRepository.Delete(item); } } _productTagRepository.Save(RequestContext); _tagRepository.Delete(tag); _tagRepository.Save(RequestContext); return(true); } catch (Exception) { return(false); } }