class ReceiptTableActionAlterations extends StubTableActionAlterations<Receipt> {

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

            if (oldReceipt.getFile() != null) {
                // Delete old file if user removed or changed it
                if (newReceipt.getFile() == null  || !newReceipt.getFile().equals(oldReceipt.getFile())) {
                    picasso.get().invalidate(oldReceipt.getFile());
                    storageManager.delete(oldReceipt.getFile());
                }
            }

            return newReceipt;
        });
    }

    public  ReceiptTableActionAlterations(@NonNull Context context,
                                         @NonNull ReceiptsTable receiptsTable,
                                         @NonNull StorageManager storageManager,
                                         @NonNull Lazy<Picasso> picasso);
      ReceiptTableActionAlterations(@NonNull Context context,
                                  @NonNull ReceiptsTable receiptsTable,
                                  @NonNull StorageManager storageManager,
                                  @NonNull BuilderFactory1<Receipt, ReceiptBuilderFactory> receiptBuilderFactoryFactory,
                                  @NonNull Lazy<Picasso> picasso);

}