public void ResetProjectData(string projectId) { if (String.IsNullOrEmpty(projectId)) { return; } Project project = _projectRepository.GetByIdCached(projectId); if (project == null) { return; } try { _errorStackRepository.RemoveAllByProjectId(projectId); _errorRepository.RemoveAllByProjectId(projectId); _dayStackStats.RemoveAllByProjectId(projectId); _monthStackStats.RemoveAllByProjectId(projectId); _dayProjectStats.RemoveAllByProjectId(projectId); _monthProjectStats.RemoveAllByProjectId(projectId); project.ErrorCount = 0; project.StackCount = 0; _projectRepository.Update(project); IQueryable <Project> orgProjects = _projectRepository.GetByOrganizationId(project.OrganizationId); Organization organization = _organizationRepository.GetById(project.OrganizationId); organization.ErrorCount = orgProjects.Sum(p => p.ErrorCount); organization.StackCount = orgProjects.Sum(p => p.StackCount); _organizationRepository.Update(organization); } catch (Exception e) { Log.Error().Project(projectId).Exception(e).Message("Error resetting project data.").Report().Write(); throw; } }