private void SetPositionValuesOn(Glue.SaveClasses.NamedObjectSave nos, InstanceSave instance)
        {
            RecursiveVariableFinder rvf = new RecursiveVariableFinder(instance, instance.ParentContainer);
            float x = rvf.GetValue<float>("X");
            float y = rvf.GetValue<float>("Y");

            #region Adjust values according to object origin

            float effectiveWidth = GetEffectiveWidth(instance);
            float effectiveHeight = GetEffectiveHeight(instance);

            HorizontalAlignment horizontalOrigin = rvf.GetValue<HorizontalAlignment>("X Origin");
            VerticalAlignment verticalOrigin = rvf.GetValue<VerticalAlignment>("Y Origin");

            switch (horizontalOrigin)
            {
                case HorizontalAlignment.Left:
                    x += effectiveWidth / 2.0f;
                    break;
                case HorizontalAlignment.Right:
                    x -= effectiveWidth / 2.0f;
                    break;

            }

            switch (verticalOrigin)
            {
                case VerticalAlignment.Top:
                    y += effectiveHeight / 2.0f;
                    break;
                case VerticalAlignment.Bottom:
                    y -= effectiveHeight / 2.0f;
                    break;
            }

            #endregion

            #region Adjust values according to alignment

            float parentWidth = GetParentWidth(instance);
            float parentHeight = GetParentHeight(instance);

            PositionUnitType xUnits = rvf.GetValue<PositionUnitType>("X Units");
            PositionUnitType yUnits = rvf.GetValue<PositionUnitType>("Y Units");

            switch (xUnits)
            {
                case PositionUnitType.PixelsFromLeft:

                    x -= parentWidth / 2.0f;

                    break;
                case PositionUnitType.PixelsFromCenterX:
                    // do nothing
                    break;
                default:
                    throw new NotImplementedException();
                    break;
            }

            switch (yUnits)
            {
                case PositionUnitType.PixelsFromTop:
                    y -= parentHeight / 2.0f;
                    break;
                case PositionUnitType.PixelsFromCenterY:
                    // do nothing
                    break;
                default:

                    break;

            }

            #endregion

            nos.SetPropertyValue("X", x);
            // Invert Y because FRB uses positive Y is up
            nos.SetPropertyValue("Y", -y);


        }