public void clearReferences() {
        if (!referencesCleared) {
            if (account != null)
                account.removeReference();

            if (transferAccount != null)
                transferAccount.removeReference();

            if (category != null)
                category.removeReference();

            if (security != null)
                security.removeReference();

            if (newSecurity != null)
                newSecurity.removeReference();

            if (splits != null) {
                for (TransactionSplit split : splits)
                    split.clearReferences();
            }

            referencesCleared = true;
        }
    }