Key association optimizations

Optimizations in key association method for faster and less error prone key association.

Also made 'host' param obligatory in associate_key api view.