private static async Task EnsureClientIsConnected()
        {
            if (client == null)
            {
                var connectionString = WebConfigurationManager.AppSettings["connectionString"];
                var databaseName     = WebConfigurationManager.AppSettings["databaseName"];
                var collectionName   = WebConfigurationManager.AppSettings["collectionName"];

                collectionLink     = string.Format("dbs/{0}/colls/{1}", databaseName, collectionName);
                documentLinkFormat = collectionLink + "/docs/{0}";

                client = await DocumentDB.GetDocumentClient(connectionString, databaseName, collectionName);
            }
        }
        public void CanRetrieveNullCollectionProperty()
        {
            /* todo: The service can return a null collection, but apparently the client needs that feature added as well
             *       I suppose it's not that big a deal though, since you have control over the object at this point
             * var create = House.CreateHouse(Guid.NewGuid().ToString("D"));
             * create.TestWindows = null;
             * client.AddToHouses(create);
             * client.SaveChanges();
             * client.Detach(create);*/

            // because of the above bug, we must create the document directly, but this is the more important path anyway
            var connectionString   = ConfigurationManager.AppSettings["connectionString"];
            var databaseName       = ConfigurationManager.AppSettings["databaseName"];
            var collectionName     = ConfigurationManager.AppSettings["collectionName"];
            var collectionLink     = string.Format("dbs/{0}/colls/{1}", databaseName, collectionName);
            var documentLinkFormat = collectionLink + "/docs/{0}";
            var task = DocumentDB.GetDocumentClient(connectionString, databaseName, collectionName);

            task.Wait();
            var docClient = task.Result;

            // make test document
            HouseDocument houseDocument = new HouseDocument();

            houseDocument.Id          = Guid.NewGuid().ToString("D");
            houseDocument.TestWindows = null;

            // insert it directly to DocumentDB
            DocumentDbExtensions.ExecuteResultWithRetry(() =>
                                                        docClient.UpsertDocumentAsync(collectionLink, houseDocument));

            // retrieve it directly from DocumentDB
            var retrievedDocument = DocumentDbExtensions.ExecuteQueryWithContinuationAndRetry(
                docClient.CreateDocumentQuery <HouseDocument>(collectionLink)
                .Where(x => x.Id == houseDocument.Id))
                                    .Single();

            // is the test set up properly?
            Assert.IsNull(retrievedDocument.TestWindows);

            // finally, test retrieval through OData
            var house = odataClient.Houses.ByKey(houseDocument.Id).GetValue();

            Assert.IsNotNull(house);
            // note: house.TestWindows will actually be deserialized as an empty collection here, but the test is
            //       that the OData service didn't throw an error when encountering that in the source document
        }