Hint:
The equalities are just equivalent to showing that
$$(I+BA)B=B(I+AB)$$
$$I=(I+A)-A$$
provided those matrix inverse are well defined.
Edit to be more specific for the first equation:
Since $(I+BA)B=B(I+AB)$, we can multiply post-multiply $(I+AB)^{-1}$ on both sides.
$$(I+BA)B(I+AB)^{-1}=B$$
Now, pre-multiply $(I+BA)^{-1}$ on both sides to get the equation that you are looking for.