internal SceneObjectPart ToSceneObjectPart()
        {
            SceneObjectPart sop = new SceneObjectPart
            {
                AngularVelocity         = this.AngularVelocityTarget,
                PhysicalAngularVelocity = this.AngularVelocity,
                BaseMask             = this.BaseMask,
                Category             = this.Category,
                ClickAction          = this.ClickAction,
                CollisionSound       = new OpenMetaverse.UUID(this.CollisionSound),
                CollisionSoundVolume = this.CollisionSoundVolume,
                CreationDate         = this.CreationDate,
                CreatorID            = new OpenMetaverse.UUID(this.CreatorId),
                Description          = this.Description,
                EveryoneMask         = this.EveryoneMask,
                Flags                   = this.Flags,
                GroupID                 = new OpenMetaverse.UUID(this.GroupId),
                GroupMask               = this.GroupMask,
                GroupPosition           = this.GroupPosition,
                Text                    = this.HoverText,
                UUID                    = new OpenMetaverse.UUID(this.Id),
                TaskInventory           = this.Inventory.ToTaskInventory(),
                LastOwnerID             = new OpenMetaverse.UUID(this.LastOwnerId),
                LinkNum                 = this.LinkNumber,
                LocalId                 = this.LocalId,
                Material                = (byte)this.Material,
                MediaUrl                = this.MediaUrl,
                Name                    = this.Name,
                NextOwnerMask           = this.NextOwnerMask,
                ObjectFlags             = (uint)this.ObjectFlags,
                ObjectSaleType          = this.ObjectSaleType,
                OffsetPosition          = this.OffsetPosition,
                OwnerID                 = new OpenMetaverse.UUID(this.OwnerId),
                OwnerMask               = this.OwnerMask,
                OwnershipCost           = this.OwnershipCost,
                ParentID                = this.ParentId,
                ParticleSystem          = this.ParticleSystem,
                PassTouches             = this.PassTouches,
                PayPrice                = this.PayPrice,
                RegionHandle            = this.RegionHandle,
                RotationOffset          = this.RotationOffset,
                SalePrice               = this.SalePrice,
                SavedAttachmentPoint    = this.SavedAttachmentPoint,
                SavedAttachmentPos      = this.SavedAttachmentPos,
                SavedAttachmentRot      = this.SavedAttachmentRot,
                Scale                   = this.Scale,
                ScriptAccessPin         = this.ScriptAccessPin,
                SerializedPhysicsData   = this.SerializedPhysicsData,
                ServerFlags             = (uint)this.ServerFlags,
                ServerWeight            = this.ServerWeight,
                Shape                   = this.Shape.ToPrimitiveBaseShape(),
                SitName                 = this.SitName,
                SitTargetOrientation    = this.SitTargetOrientation,
                SitTargetPosition       = this.SitTargetPosition,
                Sound                   = new OpenMetaverse.UUID(this.Sound),
                SoundOptions            = this.SoundFlags,
                SoundGain               = this.SoundGain,
                SoundRadius             = this.SoundRadius,
                StreamingCost           = this.StreamingCost,
                TextColor               = this.TextColor,
                TextureAnimation        = this.TextureAnimation,
                TouchName               = this.TouchName,
                Velocity                = this.Velocity,
                SerializedPhysicsShapes = this.SerializedPhysicsShapes,
                FromItemID              = new OpenMetaverse.UUID(this.FromItemId),
                KeyframeAnimation       = this.KeyframeAnimation == null ? null : this.KeyframeAnimation.ToKeyframeAnimation()
            };

            // Do legacy to current update for sop.ServerFlags.
            sop.PrepSitTargetFromStorage(sop.SitTargetPosition, sop.SitTargetOrientation);

            if (SerializedScriptStates != null)
            {
                var states = new Dictionary <OpenMetaverse.UUID, byte[]>(SerializedScriptStates.Count);
                foreach (var kvp in SerializedScriptStates)
                {
                    //map from Guid to UUID
                    states.Add(new OpenMetaverse.UUID(kvp.Key), kvp.Value);
                }

                sop.SetSavedScriptStates(states);
            }

            if (SeralizedScriptBytecode != null)
            {
                var byteCode = new Dictionary <OpenMetaverse.UUID, byte[]>(SeralizedScriptBytecode.Count);
                foreach (var kvp in SeralizedScriptBytecode)
                {
                    //map from Guid to UUID
                    byteCode.Add(new OpenMetaverse.UUID(kvp.Key), kvp.Value);
                }

                sop.SerializedScriptByteCode = byteCode;
            }

            return(sop);
        }