Let $K$ be a finite field extension of $\mathbb{Q}$ of degree $n$. Let $\mathcal{O}_K$ denote the ring of integers of $K$. I am trying to prove the following:
Claim: Let $I$ be a nonzero ideal of $\mathcal{O}_K$. Then $I$ is a free $\mathbb{Z}$-module of rank $n$.
Viewing $\mathcal{O}_K$ as a $\mathbb{Z}$-module I am aware that $\mathcal{O}_K$ is itself free of rank $n$ and since $\mathbb{Z}$ is a PID this means that any submodule of $\mathcal{O}_K$ is also free of rank $m$ with $m\leq n$. What I can't seem to show is that in this case $m = n$.
Question: How can I prove that the rank of $I$ is in fact equal to $n$? (I would be happy with a reference that answers this as well.)
Ideas That I've Tried
In Number Theory: Algebraic Numbers and Functions by Koch, it is mentioned that the statement follows from the theorem below. Here $\Gamma$ is a PID and $K$ a separable degree $n$ extension of the field of fractions of $\Gamma$. "Complete module" means "free $\Gamma$-module of rank n."
Theorem (Koch): Let $O$ be a subring of $\mathcal{O}_K$ that is closed with respect to multiplication by elements of $\Gamma$ and whose quotient field is equal to $K$. Then $O$ is a complete module in $K$.
The only nontrivial thing involved in using this theorem is to show that the field of fractions of $I$ is equal to $K$, which I cannot figure out how to do.
Another option would be to try a method similar to how one proves that $\mathcal{O}_K$ is free of rank $n$. Namely, find some $\mathbb{Z}$-module $M$ of rank $n$ that is contained in $I$. Then we have $M \subseteq I \subseteq \mathcal{O}_K$. Since $I$ can be sandwiched between two free modules of rank $n$ then it is also free of rank $n$. So far I have been unsuccessful in producing such an $M$ however.
Let $x_1, x_2,\cdots, x_n$ be an integral basis of $\mathcal{O}_K$. Since $I$ is nonzero, we can select $a\neq 0$, $a\in I$, then $ax_1, ax_2,\cdots, ax_n$ are in $I$, and they are linear independent over $\mathbb{Z}$.
Hence $I$ is a free $\mathbb{Z}$-module of rank $n$.