/// <summary>
 /// Updates the workflow state of a product version, without changing the version number.
 /// </summary>
 /// <param name="dataAccess">The data access that acts as the this instance.</param>
 /// <param name="product">The product to update.</param>
 public static void SetProductVersionState(this IDataAccess dataAccess, Product product)
 {
     dataAccess.SetProductVersionState(product.Id, product.Version, product.WorkflowState);
 }
        /// <summary>
        /// Gets the control entitlements for a user.
        /// </summary>
        /// <param name="sessionData">The session data.</param>
        /// <param name="application">The application.</param>
        /// <param name="product">The product definition.</param>
        /// <param name="pageList">The list of pages.</param>
        /// <returns>The control access for a user.</returns>
        private List<ControlAccess> GetControlAccess(SessionData sessionData, Application application, Product product, PageList pageList)
        {
            User user = this.userManager.GetUserById(sessionData.UserId);
            SecureSession secureSession = new SecureSession(sessionData.DeserializationSource, sessionData.SessionId, user);
            if (application.IsNew)
            {
                ApplicationWorkflowItem workflowItem = new ApplicationWorkflowItem(application.FormId, sessionData.UserId);
                application.WorkflowState = this.workflowService.GetInitialState(workflowItem, product.Version).Name;
            }

            var roleList = this.DataAccess.GetRoleList();

            List<ControlAccess> controlsAccess = this.entitlementProvider.GetControlsAccess(secureSession, application, pageList.AllControls, roleList, product.Version);
            return controlsAccess;
        }