Ru.GameSchool.DataLayer.Repository.LevelMaterial.FixupContentType C# (CSharp) Method

FixupContentType() private method

private FixupContentType ( ContentType previousValue ) : void
previousValue ContentType
return void
        private void FixupContentType(ContentType previousValue)
        {
            if (previousValue != null && previousValue.LevelMaterials.Contains(this))
            {
                previousValue.LevelMaterials.Remove(this);
            }
    
            if (ContentType != null)
            {
                if (!ContentType.LevelMaterials.Contains(this))
                {
                    ContentType.LevelMaterials.Add(this);
                }
                if (ContentTypeId != ContentType.ContentTypeId)
                {
                    ContentTypeId = ContentType.ContentTypeId;
                }
            }
        }