Use the firstKey to bind as foreignKeys

var foreignKey = String.IsNullOrEmpty(keyName) ?
entity.KeyColumns.FirstOrDefault() :
entity[keyName];