public async Task <bool> AddRepresentation(Representation representation)
        {
            using (var transaction = await _context.Database.BeginTransactionAsync().ConfigureAwait(false))
            {
                var result = true;
                try
                {
                    var record = new Core.EF.Models.Representation
                    {
                        Id           = representation.Id,
                        Created      = representation.Created,
                        LastModified = representation.LastModified,
                        ResourceType = representation.ResourceType,
                        Version      = representation.Version,
                        Attributes   = GetRepresentationAttributes(representation)
                    };
                    _context.Representations.Add(record);
                    await _context.SaveChangesAsync().ConfigureAwait(false);

                    transaction.Commit();
                }
                catch
                {
                    result = false;
                    transaction.Rollback();
                }

                return(result);
            }
        }
        private List <RepresentationAttribute> GetRepresentationAttributes(Core.EF.Models.Representation representation)
        {
            if (representation.Attributes == null)
            {
                return(new List <RepresentationAttribute>());
            }

            return(GetRepresentationAttributes(representation.Attributes));
        }