private async Task UniqueCheckForMatchIdAndTeamIdAndPlayerIdAsync(Stat entity, int?id = null) { var predicate = PredicateBuilder.New <Stat>(); predicate = predicate.And(p => p.MatchId == entity.MatchId); predicate = predicate.And(p => p.TeamId == entity.TeamId); predicate = predicate.And(p => p.PlayerId == entity.PlayerId); if (id != null) { predicate = predicate.And(p => p.Id != id); } var tempResult = await UnitOfWork.GetRepository <Stat, int>().GetAll(predicate: predicate).ToListAsync(); BusinessUtil.CheckUniqueValue(tempResult, WebApiConstants.MatchIdAndTeamIdAndPlayerId); }