protected void btnSave_Click(object sender, EventArgs e)
    {
        unbindHistoricalTransaction();
        targetHistoricalTransaction = SaveObject(targetHistoricalTransaction).ConvertTo <msHistoricalTransaction>();

        GoToNextUrl("Historical Transaction was saved successfully.");
    }
    /// <summary>
    /// Initializes the target object for the page
    /// </summary>
    /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing
    /// an event, the target object is an event. When looking up a directory, that's the target
    /// object. This method is intended to be overriden to initialize the target object for
    /// each page that needs it.</remarks>
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        targetHistoricalTransaction = LoadObjectFromAPI <msHistoricalTransaction>(ContextID);
        targetEvent = LoadObjectFromAPI <msEvent>(EventId);

        if (targetHistoricalTransaction == null || targetEvent == null)
        {
            GoToMissingRecordPage();
        }

        loadEventOwners();
    }
    /// <summary>
    /// Initializes the target object for the page
    /// </summary>
    /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing
    /// an event, the target object is an event. When looking up a directory, that's the target
    /// object. This method is intended to be overriden to initialize the target object for
    /// each page that needs it.</remarks>
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        //Describe a Historical Transaction.  We will need this metadata to bind to the acceptable values for certain fields and for creating a new event
        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            historicalTransactionClassMetadata = proxy.DescribeObject(msHistoricalTransaction.CLASS_NAME).ResultValue;
            historicalTransactionFieldMetadata = historicalTransactionClassMetadata.GenerateFieldDictionary();
        }

        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

        if (contextObject == null)
        {
            GoToMissingRecordPage();
            return;
        }

        switch (contextObject.ClassType)
        {
        case msOrder.CLASS_NAME:
            targetOrder = contextObject.ConvertTo <msOrder>();
            targetHistoricalTransaction =
                msHistoricalTransaction.FromClassMetadata(historicalTransactionClassMetadata);
            targetHistoricalTransaction.Type = HistoricalTransactionType.Payment;
            break;

        case msHistoricalTransaction.CLASS_NAME:
            targetHistoricalTransaction = contextObject.ConvertTo <msHistoricalTransaction>();
            targetOrder = LoadObjectFromAPI <msOrder>(targetHistoricalTransaction.Order);
            break;

        default:
            QueueBannerError(string.Format("Unknown context object type supplied '{0}'.", contextObject.ClassType));
            GoHome();
            return;
        }

        targetEvent = LoadObjectFromAPI <msEvent>(EventId);

        if (targetOrder == null || targetHistoricalTransaction == null || targetEvent == null)
        {
            GoToMissingRecordPage();
            return;
        }

        loadEventOwners();
    }