public void Save() { var stream = _configFile.GetStream(); using (stream) { var result = _validator.Validate(_configuration); if (!result.IsValid) { throw new ConfigurationException(result.Message); } Serializer.WriteObject(stream, _configuration); } }