private IDocumentEntity GetTemplateFolderTree(Guid masterFolderGuid, string resourceType, Guid resourceId, string pathPrefixName)
        {
            var structureApplied = _documentManagementService.HasDefaultStructure(resourceType, resourceId);
            var contract         = _contractsService.GetContractEntityByContractId(resourceId);

            if (!structureApplied && contract != null)
            {
                var masterData = _folderStructureMasterService.GetActive("ESSWeb", resourceType);
                if (masterData.Count() > 0)
                {
                    var templateFolders = _folderStructureFolderService.GetFolderTree(masterData.SingleOrDefault().FolderStructureMasterGuid);
                    _documentManagementService.ManageDefaultStructure(resourceId.ToString(), contract.ContractNumber, templateFolders, resourceType, resourceId, UserHelper.CurrentUserGuid(HttpContext));
                }
            }
            var folders = _documentManagementService.GetFolderByMasterFolderGuid(masterFolderGuid, resourceType, resourceId);

            return(folders);
        }