Stored light in linear and nonlinear dielectrics