/**
         * Get all dirty documents in the collection from the given document array.
         */
        public JArray allDirtyWithDocuments(JArray documents)
        {
            JSONStoreSQLLite store = JSONStoreSQLLite.sharedManager();

            if (store == null)
            {
                throw new JSONStoreException(JSONStoreConstants.JSON_STORE_DATABASE_NOT_OPEN);
            }


            JArray docsToReturn = new JArray();

            lock (JSONStore.lockThis)
            {
                JArray retArr = store.allDirtyInCollection(collectionName);

                if (retArr.Count > 0)
                {
                    foreach (JObject md in retArr)
                    {
                        //If we are passed an array of docs from pushSelected, we
                        //only want to return those that are actually dirty in the database.
                        if (documents.Count > 0)
                        {
                            string dirtyId = md.GetValue(JSONStoreConstants.JSON_STORE_FIELD_ID).ToString();
                            foreach (JObject doc in documents)
                            {
                                if (doc.GetValue(JSONStoreConstants.JSON_STORE_FIELD_ID).ToString().Equals(dirtyId))
                                {
                                    docsToReturn.Add(md);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            docsToReturn.Add(md);
                        }

                        //[JSONStoreCollection _changeJSONBlobToDictionaryWithDictionary:md];
                    }
                }

                return(docsToReturn);
            }
        }