private Quote GetQuote(int quoteId) { Model.Quote quote = _quoteManager.GetQuote(quoteId); if (quote != null) { var quoteVm = Mapper.Map<Quote>(quote); ClientManager clientManager = new ClientManager(); quoteVm.Clients = Mapper.Map<List<Models.Client.Client>>(clientManager.GetClients()) .OrderBy(i => i.ClientName) .ToList(); if (quoteVm.Awarded) { var pManager = new ProjectManager(); Model.Project associatedProject = pManager.FindAwardedProject(quoteId); if (associatedProject != null) { quoteVm.AssociatedProject = Mapper.Map<Models.Project.Project>(associatedProject); } else { quoteVm.PossibleProjects = Mapper.Map<List<Models.Project.Project>>(pManager.GetProjects(active: true, hasQuote: false)) .OrderByDescending(i => i.ProjectName) .ToList(); } } return quoteVm; } return null; }