/// <summary>
 /// Constructor for building a new simple object with the POCO class
 /// </summary>
 public ProjectClassificationSimple(ProjectClassification projectClassification)
     : this()
 {
     ProjectID              = projectClassification.ProjectID;
     ClassificationID       = projectClassification.ClassificationID;
     ClassificationSystemID = projectClassification.Classification.ClassificationSystemID;
 }
        public void UpdateModel(ProjectFirmaModels.Models.Project project, List <ProjectClassificationSimple> projectClassificationSimples)
        {
            foreach (var projectClassificationSimple in projectClassificationSimples)
            {
                var alreadySelected = project.ProjectClassifications
                                      .SingleOrDefault(x => x.ClassificationID == projectClassificationSimple.ClassificationID) != null;

                if (projectClassificationSimple.Selected && !alreadySelected)
                {
                    var projectClassification = new ProjectFirmaModels.Models.ProjectClassification(project.ProjectID,
                                                                                                    projectClassificationSimple.ClassificationID)
                    {
                        ProjectClassificationNotes = projectClassificationSimple.ProjectClassificationNotes
                    };

                    project.ProjectClassifications.Add(projectClassification);
                }
                else if (projectClassificationSimple.Selected && alreadySelected)
                {
                    var existingProjectClassification = project.ProjectClassifications.First(x => x.ClassificationID == projectClassificationSimple.ClassificationID);
                    existingProjectClassification.ProjectClassificationNotes = projectClassificationSimple.ProjectClassificationNotes;
                }
                else if (!projectClassificationSimple.Selected && alreadySelected)
                {
                    var existingProjectClassification = project.ProjectClassifications.First(x => x.ClassificationID == projectClassificationSimple.ClassificationID);
                    existingProjectClassification.DeleteFull(HttpRequestStorage.DatabaseEntities);
                }
            }
        }