move code from providerdetail controller to library to make controller cleaner