@Override
  public void synchronizeLocalDatabase() {
    fireOnStart();
    fireOnTaskChange(I18N.CONSTANTS.synchronizerOrganizationDownload_0());

    final Factory factory = Factory.getInstance();

    if (factory != null) {

      dispatcher.execute(
          new GetOrganization(authentication.getOrganizationId()),
          null,
          new AsyncCallback<OrganizationDTO>() {

            @Override
            public void onFailure(Throwable caught) {
              fireOnFailure(
                  false,
                  I18N.CONSTANTS.synchronizerOrganizationDownload_0_failed() + caught.getMessage());
            }

            @Override
            public void onSuccess(OrganizationDTO result) {
              final Database database = factory.createDatabase();
              database.open(OnlineMode.LOCAL_DATABASE_NAME);

              try {
                fireOnUpdate(0.1);
                fireOnTaskChange(I18N.CONSTANTS.synchronizerOrganizationDownload_1());
                OrganizationDAO.createTablesIfNotExists(database);

                fireOnUpdate(0.2);
                fireOnTaskChange(I18N.CONSTANTS.synchronizerOrganizationDownload_2());
                OrganizationDAO.insertOrReplaceOrganization(result, database);

                final LocalServer localServer = factory.createLocalServer();
                final ResourceStore store = localServer.createStore(OnlineMode.LOCAL_DATABASE_NAME);

                fireOnUpdate(0.8);
                fireOnTaskChange(I18N.CONSTANTS.synchronizerOrganizationDownload_3());
                store.capture(
                    new ResourceStoreUrlCaptureHandler() {

                      @Override
                      public void onCapture(ResourceStoreUrlCaptureEvent event) {
                        fireOnComplete();
                      }
                    },
                    GWT.getModuleBaseURL()
                        + "image-provider?"
                        + FileUploadUtils.IMAGE_URL
                        + "="
                        + result.getLogo());

              } catch (DatabaseException ex) {
                Log.debug("Error while writing the organization dto to the local database.", ex);
                fireOnFailure(
                    false,
                    I18N.CONSTANTS.synchronizerOrganizationDownload_0_failed() + ex.getMessage());

              } finally {
                try {
                  database.close();
                } catch (DatabaseException ex) {
                  Log.debug("Database closing error.", ex);
                  fireOnFailure(
                      false,
                      I18N.CONSTANTS.synchronizerOrganizationDownload_0_failed() + ex.getMessage());
                }
              }
            }
          });

    } else
      fireOnFailure(
          false,
          I18N.CONSTANTS.synchronizerOrganizationDownload_0_failed()
              + "Google Gears isn't available.");
  }