private IEnumerable <EntityContainer> GetEntityContainers(IContentTypeComposition?contentType, UmbracoObjectTypes type) { if (contentType == null) { return(Enumerable.Empty <EntityContainer>()); } switch (type) { case UmbracoObjectTypes.DocumentType: if (contentType is IContentType documentContentType) { return(ContentTypeService.GetContainers(documentContentType)); } return(Enumerable.Empty <EntityContainer>()); case UmbracoObjectTypes.MediaType: if (contentType is IMediaType mediaContentType) { return(MediaTypeService.GetContainers(mediaContentType)); } return(Enumerable.Empty <EntityContainer>()); case UmbracoObjectTypes.MemberType: return(Enumerable.Empty <EntityContainer>()); default: throw new ArgumentOutOfRangeException("The entity type was not a content type"); } }