I'd love to refactor the code below.

Here are the requirements.

**if `initial_invoice?` is `false`, `existing_invoice` always exists.**

**if `initial_invoice?` is `true` and `existing_invoice` exists, i'd love to use the `existing_invoice` .**


     existing_invoice = find_existing_invoice(invoice_obj[:id])
       invoice = if !initial_invoice?(invoice_obj) || existing_invoice.present?
                    existing_invoice
                  else
                    ac = Account.find_by(stripe_customer_id: invoice_obj[:customer])
                    create_initial_invoice(invoice_obj, ac)
                  end
    
      private
    
      def find_existing_invoice(id)
        Invoice.find_by(stripe_invoice_id: id)
      end
    
      def initial_invoice?(invoice_obj)
        sub_id = invoice_obj[:subscription]
        return false if sub_id.nil?
    
        sub = Stripe::Subscription.retrieve(sub_id)
        return false unless invoice_obj[:period_start] == sub[:created]
        true
      end