public ActionResult New(EditInteractionEventViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(InteractionEventViewEdit(viewModel, EditInteractionEventEditType.NewInteractionEventEdit));
            }

            var interactionEvent = new InteractionEvent(viewModel.InteractionEventTypeID, viewModel.Title, viewModel.Date);

            viewModel.UpdateModel(interactionEvent, CurrentPerson, new List <InteractionEventProject>(), new List <InteractionEventContact>());
            HttpRequestStorage.DatabaseEntities.InteractionEvents.Add(interactionEvent);
            SetMessageForDisplay($"{FieldDefinition.InteractionEvent.FieldDefinitionDisplayName} \"{interactionEvent.InteractionEventTitle}\" successfully created.");
            return(new ModalDialogFormJsonResult());
        }
        public ActionResult EditInteractionEvent(InteractionEventPrimaryKey interactionEventPrimaryKey, EditInteractionEventViewModel viewModel)
        {
            var interactionEvent = interactionEventPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(InteractionEventViewEdit(viewModel, EditInteractionEventEditType.ExistingInteractionEventEdit));
            }
            HttpRequestStorage.DatabaseEntities.InteractionEventProjects.Load();
            var interactionEventProjects = HttpRequestStorage.DatabaseEntities.InteractionEventProjects.Local;

            HttpRequestStorage.DatabaseEntities.InteractionEventContacts.Load();
            var interactionEventContacts = HttpRequestStorage.DatabaseEntities.InteractionEventContacts.Local;

            viewModel.UpdateModel(interactionEvent, CurrentPerson, interactionEventProjects, interactionEventContacts);

            HttpRequestStorage.DatabaseEntities.SaveChanges();

            return(new ModalDialogFormJsonResult());
        }