Deduce the expression for the electrostatic energy stored in a capacitor of capacitance 'C' and having charge 'Q'

Deduce the expression for the electrostatic energy stored in a capacitor of capacitance ‘C’ and having charge ‘Q’.
How will the (i) energy stored and (ii) the electric field inside the capacitor be affected when it is completely filled with a dielectric material of dielectric constant ‘K’ ?