Fix bug DNN-4944: use double check when add file into db to make sure thread safe.
Fix bug DNN-4954: use the portal settings of the tab stay in to generate the tab url.