var methods = controller.GetType().GetMethods()
                .Where(m => m.Name.StartsWith(request.HttpMethod, true, CultureInfo.InvariantCulture));
            
            var method = methods.SingleOrDefault(m =>
            {
                var hasIdArgument = m.GetParameters().Any(p => p.Name.Equals("id", StringComparison.InvariantCultureIgnoreCase));
                return hasIdArgument && id != null || !hasIdArgument && id == null;
            });