string GetCloudModelLocalCacheFilepath(
            Document doc,
            string version_number)
        {
            string title          = doc.Title;
            string ext            = Path.GetExtension(doc.PathName);
            string localRevitFile = null;

            if (doc.IsModelInCloud)
            {
                ModelPath modelPath = doc.GetCloudModelPath();
                string    guid      = modelPath.GetModelGUID().ToString();

                string folder = "C:\\Users\\" + Environment.UserName
                                + "\\AppData\\Local\\Autodesk\\Revit\\Autodesk Revit "
                                + version_number + "\\CollaborationCache";

                string revitFile = guid + ext;

                string[] files = Directory
                                 .GetFiles(folder, revitFile, SearchOption.AllDirectories)
                                 .Where(c => !c.Contains("CentralCache"))
                                 .ToArray();

                if (0 < files.Length)
                {
                    localRevitFile = files[0];
                }
                else
                {
                    Debug.Print("Unable to find local rvt for: " + doc.PathName);
                }
            }
            else
            {
                localRevitFile = doc.PathName;
            }
            return(localRevitFile);
        }
        //public long CadImportCount { get; private  set; }
        //public long CadLinkCount { get; private set; }

        //Constructor
        public ElementPropertiesWrapper(Document revitDoc)
        {
            // Get single timestamp to apply to all elements this query
            RevitFileTimeStampUtc = DateTime.UtcNow;
            FileTimeStampCounter  = UtcDateTimeToUnix(RevitFileTimeStampUtc);

            RevitFilePath = revitDoc.PathName;

            IsBim360Model = revitDoc.IsModelInCloud;
            ProjectNumber = revitDoc.ProjectInformation.Number;
            ProjectName   = revitDoc.ProjectInformation.Name;
            FileVersion   = revitDoc.Application.VersionNumber;

            if (!IsBim360Model)
            {
                FileInfo fi = new FileInfo(revitDoc.PathName);
                FileSize = fi.Length / 1024;
            }
            else
            {
                FileSize = null;
            }

            try
            {
                if (IsBim360Model)
                {
                    ModelPath mp = revitDoc.GetCloudModelPath();
                    ModelGuid         = mp.GetModelGUID();
                    ProjectGuid       = mp.GetProjectGUID();
                    CentralServerPath = mp.CentralServerPath;
                    CloudPath         = mp.CloudPath;
                    ServerPath        = mp.ServerPath;
                }
            }
            catch (Exception ex)
            {
                CentralServerPath = null;
                CloudPath         = false;
                ServerPath        = false;
            }

            WarningsCount = revitDoc.GetWarnings().Count;

            // Get ALL elements:
            IEnumerable <Element> allElements = new FilteredElementCollector(revitDoc)
                                                .WhereElementIsNotElementType()
                                                .ToElements()
                                                .Where(e => e.Name != string.Empty)
                                                .Where(c => null != c.Category)
                                                .Where(c => !c.Category.Name.Contains("Sketch"));


            this.ElementCount = allElements.Count();


            foreach (Element e in allElements)
            {
                ElementProps props = new ElementProps(e);

                // Collect the element:
                m_model_elements.Add(props);
            }

            // ROOMS
            List <SpatialElement> rms = new FilteredElementCollector(revitDoc)
                                        .OfClass(typeof(SpatialElement))
                                        .Cast <SpatialElement>()
                                        .ToList <SpatialElement>();

            if (rms.Count > 0)
            {
                foreach (SpatialElement se in rms)
                {
                    Room r = se as Room;
                    if (null != r)
                    {
                        m_model_rooms.Add(new RevitRoom(r));
                    }
                }
            }
            this.RoomCount = m_model_rooms.Count;

            // VIEWS
            List <View> vws = new FilteredElementCollector(revitDoc)
                              .OfClass(typeof(View))
                              .Cast <View>()
                              .ToList <View>();

            foreach (View v in vws)
            {
                m_model_views.Add(new RevitView(v));
            }
        }