public void Log(Crash crash)
{
Application application = this.applicationRepository.Find(crash.ApplicationId);
if (application != null)
{
DeviceInfo device = this.deviceRepository.Find(crash.DeviceId);
if (device != null)
{
string lastScreenBeforeCrash = null;
DeviceAppLastScreen appLastScreen =
this.eventRepository.GetDeviceAppLastScreenOneBy(crash.DeviceId, crash.ApplicationId);
if (appLastScreen != null)
{
lastScreenBeforeCrash = appLastScreen.ScreenName;
}
crash.Add(device, lastScreenBeforeCrash);
CrashSummary crashSummary = new CrashSummary(crash);
this.crashRepository.Save(crash);
this.crashRepository.Save(crashSummary);
}
else
{
throw new NoDeviceException(crash.DeviceId);
}
}
else
{
throw new InactiveApplicationException(crash.ApplicationId);
}
}