private async Task CheckTransactionTypeAsync(int id, string type) { var dbTransactionType = await _transactionType.GetTransactionTypeAsync(d => d.Type == type && d.Id != id); if (dbTransactionType != null) { throw new RestException(HttpStatusCode.Conflict, $"Transaction type \"{type}\" is already available."); } }