private void FormatDocuments(CameraSensorDocument doc)
 {
     foreach (var item in doc.visits)
     {
         item.gender = "/Assets/"+ item.gender + ".png";
         item.date = item.date.ToLocalTime();
         TimeSpan difference = (DateTime.Now - item.date);
         if(difference.Days>0)
             item.transformedDate = String.Format("{0} days ago", difference.Days);
         else
         {
             if (difference.Hours > 0)
                 item.transformedDate = String.Format("{0} hours ago", difference.Hours);
             else
             {
                 if (difference.Minutes> 0)
                     item.transformedDate = String.Format("{0} minutes ago", difference.Minutes);
                 else item.transformedDate = String.Format("{0} seconds ago", difference.Seconds);
             }
         }
     }                   
 }
 public static async Task<string> createCameraDocument(CameraSensorDocument document)
 {
     string jsonFile = JsonConvert.SerializeObject(document);
     return await CRUD.createDocument(accountID, databaseID, collectionID, jsonFile);
 }
        private async void LoadDocuments()
        {
            document1 = await documentDBUtilities.getCameraDocument("bBNBAPFVBgAMAAAAAAAAAA==");
            document1.visits.Sort((a, b) => b.date.CompareTo(a.date));
            FormatDocuments(document1);
            lstKiosk1.ItemsSource = document1.visits;

            document2 = await documentDBUtilities.getCameraDocument("bBNBAPFVBgAPAAAAAAAAAA==");
            document2.visits.Sort((a, b) => b.date.CompareTo(a.date));
            FormatDocuments(document2);
            lstKiosk2.ItemsSource = document2.visits;

            document3 = await documentDBUtilities.getCameraDocument("bBNBAPFVBgAQAAAAAAAAAA==");
            document3.visits.Sort((a, b) => b.date.CompareTo(a.date));
            FormatDocuments(document3);
            lstKiosk3.ItemsSource = document3.visits;
        }