refactoring grant_write_link_<provider> code - 1