private void SetupKeyboardLayout()
        {
            if (!string.IsNullOrWhiteSpace(windowState) ||
                !string.IsNullOrWhiteSpace(position) ||
                !string.IsNullOrWhiteSpace(dockSize) ||
                !string.IsNullOrWhiteSpace(width) ||
                !string.IsNullOrWhiteSpace(height) ||
                !string.IsNullOrWhiteSpace(horizontalOffset) ||
                !string.IsNullOrWhiteSpace(verticalOffset))
            {
                string           errorMessage = null;
                double           validNumber;
                WindowStates     validWindowState;
                MoveToDirections validPosition;
                DockSizes        validDockSize;
                if (!string.IsNullOrWhiteSpace(windowState) && !Enum.TryParse <WindowStates>(windowState, out validWindowState))
                {
                    errorMessage = "WindowState not valid";
                }
                else if (!string.IsNullOrWhiteSpace(position) && !Enum.TryParse <MoveToDirections>(position, out validPosition))
                {
                    errorMessage = "Position not valid";
                }
                else if (!string.IsNullOrWhiteSpace(dockSize) && !Enum.TryParse <DockSizes>(dockSize, out validDockSize))
                {
                    errorMessage = "DockSize not valid";
                }
                else if (!string.IsNullOrWhiteSpace(width) &&
                         !(double.TryParse(width.Replace("%", ""), out validNumber) && validNumber >= -9999 && validNumber <= 9999))
                {
                    errorMessage = "Width must be between -9999 and 9999";
                }
                else if (!string.IsNullOrWhiteSpace(height) &&
                         !(double.TryParse(height.Replace("%", ""), out validNumber) && validNumber >= -9999 && validNumber <= 9999))
                {
                    errorMessage = "Height must be between -9999 and 9999";
                }
                else if (!string.IsNullOrWhiteSpace(horizontalOffset) &&
                         !(double.TryParse(horizontalOffset.Replace("%", ""), out validNumber) && validNumber >= -9999 && validNumber <= 9999))
                {
                    errorMessage = "Offset must be between -9999 and 9999";
                }
                else if (!string.IsNullOrWhiteSpace(verticalOffset) &&
                         !(double.TryParse(verticalOffset.Replace("%", ""), out validNumber) && validNumber >= -9999 && validNumber <= 9999))
                {
                    errorMessage = "Offset must be between -9999 and 9999";
                }

                if (errorMessage != null)
                {
                    raiseToastNotification(Resources.DYNAMIC_KEYBOARD_DEFINITION_INVALID, errorMessage,
                                           NotificationTypes.Error, () => { });
                    return;
                }
            }

            Log.InfoFormat("Overriding size and position for dynamic keyboard");
            windowManipulationService.OverridePersistedState(persistNewState, windowState, position, dockSize, width, height, horizontalOffset, verticalOffset);
        }