class DistanceDatabaseAdapter implements SelectionBackedDatabaseAdapter<Distance, Trip> {

    @NonNull
    @Override
    public ContentValues write(@NonNull Distance distance, @NonNull DatabaseOperationMetadata databaseOperationMetadata) {
        final ContentValues values = new ContentValues();

        values.put(DistanceTable.COLUMN_PARENT_TRIP_ID, distance.getTrip().getId());
        values.put(DistanceTable.COLUMN_LOCATION, distance.getLocation().trim());
        values.put(DistanceTable.COLUMN_DISTANCE, distance.getDistance().doubleValue());
        values.put(DistanceTable.COLUMN_TIMEZONE, distance.getTimeZone().getID());
        values.put(DistanceTable.COLUMN_DATE, distance.getDate().getTime());
        values.put(DistanceTable.COLUMN_RATE, distance.getRate().doubleValue());
        values.put(DistanceTable.COLUMN_RATE_CURRENCY, distance.getPrice().getCurrencyCode());
        values.put(DistanceTable.COLUMN_COMMENT, distance.getComment().trim());
        values.put(DistanceTable.COLUMN_UUID, distance.getUuid().toString());
        values.put(DistanceTable.COLUMN_PAYMENT_METHOD_ID, distance.getPaymentMethod().getId());
        values.put(DistanceTable.COLUMN_LOCATION_HIDDEN_AUTO_COMPLETE, distance.getAutoCompleteMetadata().isLocationHiddenFromAutoComplete());
        values.put(DistanceTable.COLUMN_COMMENT_HIDDEN_AUTO_COMPLETE, distance.getAutoCompleteMetadata().isCommentHiddenFromAutoComplete());
        if (databaseOperationMetadata.getOperationFamilyType() == OperationFamilyType.Sync) {
            values.putAll(mSyncStateAdapter.write(distance.getSyncState()));
        } else {
            values.putAll(mSyncStateAdapter.writeUnsynced(distance.getSyncState()));
        }

        return values;
    }

    public  DistanceDatabaseAdapter(@NonNull Table<Trip> tripsTable, @NonNull Table<PaymentMethod> paymentMethodTable);
    public  DistanceDatabaseAdapter(@NonNull Table<Trip> tripsTable, @NonNull Table<PaymentMethod> paymentMethodTable,
                                   @NonNull SyncStateAdapter syncStateAdapter);

}