std::list<Job*>* PersistentStorage::GetJobs(EncryptionKeys* keys, OsIndependentString* where)
{
  std::list<Job*>* results = new std::list<Job*>();
  OsIndependentSQLiteDatabase* database = databaseHelper->GetReadableDatabase();
  OsIndependentCursor* cursor = nullptr;
  try
  {
    cursor = database->Query((OsIndependentString*)TABLE_NAME, nullptr, where, nullptr, nullptr, nullptr, ID->Append(FactoryString::GetInstance()->CreateNewString(" ASC")), nullptr);
    while (cursor->MoveToNext())
    {
      long id = cursor->GetLong(cursor->GetColumnIndexOrThrow((OsIndependentString*)ID));
      OsIndependentString* item = cursor->GetString(cursor->GetColumnIndexOrThrow((OsIndependentString*)ITEM));
      bool encrypted = cursor->GetInt(cursor->GetColumnIndexOrThrow((OsIndependentString*)ENCRYPTED)) == 1;
      try
      {
        Job* job = jobSerializer->Deserialize(keys, encrypted, item);
        job->SetPersistentId(id);
        job->SetEncryptionKeys(keys);
        dependencyInjector->InjectDependencies(context, job);
        results->push_back(job);
      }
      catch (IOException e)
      {
        // Log.w("PersistentStore", e);
        Remove(id);
      }
    }
  }
  catch (IOException e)
  {
  }
  if (cursor != nullptr)
    cursor->Close();
  return results;
}