public function doAddDiscount($data, $form)
    {
        $code_to_search = $data['DiscountCode'];

        // First check if the discount is already added (so we don't
        // query the DB if we don't have to).
        if (!$this->discount || ($this->discount && $this->discount->Code != $code_to_search)) {
            $code = Discount::get()
                ->filter("Code", $code_to_search)
                ->exclude("Expires:LessThan", date("Y-m-d"))
                ->first();

            if ($code) {
                $this->discount = $code;
            }
        }

        $this->save();

        return $this->redirectBack();
    }