public Server.Application.WorkflowUserInteractionResponseBase HandleUserInteraction_ContactEntity(System.Collections.Specialized.NameValueCollection form)
        {
            Server.Application.WorkflowUserInteractionResponseContactEntity contactResponse = null;

            entityContactModel = new Controls.EntityContactModel(form);                 // CREATE MODEL, UPDATE VALUES FROM STORE (EITHER CLIENT OR SESSION)

            entityContactModel.RaiseEvent(form["EventTarget"], form["EventArguments"]); // RAISE EVENT, VALIDATE


            // IF CANCEL WAS REQUESTED, OR A VALID ENTITY CONTACT CREATED, CREATE RESPONSE TO CONTINUE WORKFLOW

            if ((entityContactModel.Canceled) || (entityContactModel.EntityContact != null))
            {
                // CREATE CUSTOM CONTACT RESPONSE

                contactResponse = new Server.Application.WorkflowUserInteractionResponseContactEntity();

                contactResponse.InteractionType = Server.Application.UserInteractionType.ContactEntity;

                if (entityContactModel.EntityContact != null)
                {
                    contactResponse.EntityContact = (Mercury.Server.Application.EntityContact)entityContactModel.EntityContact.ToServerObject();
                }

                contactResponse.Cancel = entityContactModel.Canceled;
            }

            return(contactResponse);
        }
        protected void HandleWorkflowResponse_ContactEntity()
        {
            Server.Application.WorkflowUserInteractionRequestContactEntity contactEntityRequest;

            contactEntityRequest = (Server.Application.WorkflowUserInteractionRequestContactEntity)WorkflowResponse.UserInteractionRequest;


            if (contactEntityRequest.Entity == null)
            {
                // NO ENTITY SPECIFIED FOR CONTACT - ERROR

                SetException("Contact Entity Request has no Entity assigned to it to contact. Unable to continue.");

                return;
            }


            entity = new Client.Core.Entity.Entity(MercuryApplication, contactEntityRequest.Entity);

            entityContactModel = new Controls.EntityContactModel(contactEntityRequest.Entity, contactEntityRequest.RelatedEntity);

            entityContactModel.StoreModelStateInMemory = StoreModelStateInMemory;

            entityContactModel.AllowEditContactDateTime = contactEntityRequest.AllowEditContactDateTime;

            entityContactModel.AllowCancel = contactEntityRequest.AllowCancel;

            entityContactModel.AllowEditRegarding = contactEntityRequest.AllowEditRegarding;

            entityContactModel.AllowEditRelatedEntity = contactEntityRequest.AllowEditRelatedEntity;

            entityContactModel.Attempt = contactEntityRequest.Attempt;

            entityContactModel.IntroductionScript = contactEntityRequest.IntroductionScript;

            entityContactModel.ContactRegarding = contactEntityRequest.Regarding;


            switch (entity.EntityType)
            {
            case Server.Application.EntityType.Member:

                WorkflowControlResponseScript = "WorkQueueItemInformation_SetMember ('" + Member.Id + "');";

                break;
            }



            workflowControl = "/Views/Workflow/WorkflowControls/ContactEntity.cshtml";

            //contactEntityControl.ResponseScript = ResponseScriptWorkflowContinue;

            return;
        }