public CustomFormat Insert(CustomFormat customFormat) { var ret = _formatRepository.Insert(customFormat); try { ProfileService.AddCustomFormat(ret); } catch (Exception e) { _logger.Error("Failure while trying to add the new custom format to all profiles.", e); _formatRepository.Delete(ret); throw; } _cache.Clear(); return(ret); }