private List <int> GetMatchingValue(List <int> setValues, List <int> finalValueOptions, int requiredSum) { var operands = finalValueOptions.Select(x => { var vals = setValues.ToList(); vals.Add(x); return(vals); }) .ToList(); var operations = operands.Select(x => operationFactory.CreateAddOperation(x)); foreach (var op in operations) { var result = mathematicOperationEvaluator.EvaluateOperation(op); if (result == requiredSum) { return(op.Operands); } } return(null); }