class SyncIntentService extends BaseSyncIntentService {

    private boolean pushECToServer(EventClientRepository db) {
        boolean isSuccessfulPushSync = true;

        // push foreign events to server
        int totalEventCount = db.getUnSyncedEventsCount();
        int eventsUploadedCount = 0;

        while (true) {
            Map<String, Object> pendingEvents = db.getUnSyncedEvents(EVENT_PUSH_LIMIT);

            if (pendingEvents.isEmpty()) {
                break;
            }

            String baseUrl = CoreLibrary.getInstance().context().configuration().dristhiBaseURL();
            if (baseUrl.endsWith(context.getString(R.string.url_separator))) {
                baseUrl = baseUrl.substring(0, baseUrl.lastIndexOf(context.getString(R.string.url_separator)));
            }
            // create request body
            JSONObject request = new JSONObject();
            try {
                if (pendingEvents.containsKey(AllConstants.KEY.CLIENTS)) {
                    Object value = pendingEvents.get(AllConstants.KEY.CLIENTS);
                    request.put(AllConstants.KEY.CLIENTS, value);

                    if (value instanceof List) {
                        eventsUploadedCount += ((List) value).size();
                    }
                }
                if (pendingEvents.containsKey(AllConstants.KEY.EVENTS)) {
                    request.put(AllConstants.KEY.EVENTS, pendingEvents.get(AllConstants.KEY.EVENTS));
                }
            } catch (JSONException e) {
                Timber.e(e);
            }
            String jsonPayload = request.toString();
            Response<String> response = httpAgent.post(
                    MessageFormat.format("{0}/{1}",
                            baseUrl,
                            ADD_URL),
                    jsonPayload);
            if (response.isFailure()) {
                Timber.e("Events sync failed.");
                isSuccessfulPushSync = false;
            }
            db.markEventsAsSynced(pendingEvents);
            Timber.i("Events synced successfully.");
            updateProgress(eventsUploadedCount, totalEventCount);
        }

        return isSuccessfulPushSync;
    }

    public  SyncIntentService();
    public  SyncIntentService(String name);

}