class TripTableActionAlterations extends StubTableActionAlterations<Trip> {

    @NonNull
    @Override
    public Single<Trip> postUpdate(@NonNull final Trip oldTrip, @Nullable final Trip newTrip) {
        return Single.fromCallable(() -> {
            if (newTrip == null) {
                throw new Exception("Post update failed due to a null trip");
            }

            newTrip.setPrice(oldTrip.getPrice());
            newTrip.setDailySubTotal(oldTrip.getDailySubTotal());

            return newTrip;
        }).doOnSuccess(trip -> {
            if (!oldTrip.getDirectory().equals(trip.getDirectory())) {

                mReceiptsTable.updateParentBlocking(oldTrip, trip);
                mDistanceTable.updateParentBlocking(oldTrip, trip);
                final File dir = mStorageManager.rename(oldTrip.getDirectory(), trip.getName());
                if (dir.equals(oldTrip.getDirectory())) {
                    Logger.error(this, "Failed to re-name the trip directory... Rolling back and throwing an exception");
                    mTripsTable.update(trip, oldTrip, new DatabaseOperationMetadata()).blockingGet();
                    mReceiptsTable.updateParentBlocking(trip, oldTrip);
                    mDistanceTable.updateParentBlocking(trip, oldTrip);

                    throw new IOException("Failed to create trip directory");
                }
            }
        });
    }

    public  TripTableActionAlterations(@NonNull PersistenceManager persistenceManager);
    public  TripTableActionAlterations(@NonNull DatabaseHelper databaseHelper, @NonNull StorageManager storageManager);
    public  TripTableActionAlterations(@NonNull Table<Trip> tripsTable, @NonNull ReceiptsTable receiptsTable, @NonNull DistanceTable distanceTable,
                                      @NonNull DatabaseHelper databaseHelper, @NonNull StorageManager storageManager);

}