/// <summary>
        /// Sets entity attributes according to a given attributes JSON object
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="newAttributes"></param>
        /// <param name="context"></param>
        /// <param name="onlyFillables"></param>
        public static void SetAttributes(
            Entity entity,
            JsonObject newAttributes,
            DeserializationContext context,
            bool onlyFillables = false
            )
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (newAttributes == null)
            {
                throw new ArgumentNullException(nameof(newAttributes));
            }

            DefaultSerializer.PopulateInstance(
                entity,
                newAttributes,
                context,
                onlyFillables
                );

            // the entity enters the server security domain
            if (context.securityDomainCrossing == SecurityDomainCrossing.EnteringServer)
            {
                // it contains insecure data if the ID is not null
                // (an entity can be created elsewhere, but not modified)
                if (entity.EntityId != null)
                {
                    entity.ContainsInsecureData = true;
                }
            }
        }