I am using Entity Framework 6 and I need to update the properties of a entity.

I have the following entities:

```
public class File 
{
  public Int32 Id { get; set; }
  public Byte Data { get; set; }
  public DateTime Updated { get; set; }
  public virtual Mime Mime { get; set; }
}
public class Mime 
{
  public Int32 Id { get; set; }
  public String Name { get; set; }
  public virtual ICollection<File> Files { get; set; }
}

```

Then I used the following:

```
_repository.Update<File>(file, x => x.Data, x => x.Mime, x => x.Updated);

```

The repository method is the following:

```
public void Update<T>(T entity,
                      params Expression<Func<T, Object>>[] properties)
                      where T : class 
{

  _context.Set<T>().Attach(entity);

  foreach (var property in properties) 
  {
    MemberExpression expression =
                     property.Body is MemberExpression ? 
                     (MemberExpression)property.Body : 
                     (MemberExpression)(((UnaryExpression)property.Body)
                                                                  .Operand);
    _context.Entry<T>(entity)
            .Property(expression.Member.Name).IsModified = true;
  }
}

```

This works fine for `Data` and Updated properties but not for `Mime`. I get the error:

> 
> The property 'Mime' on type 'File' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method.
> 
> 
> 

Is it possible to make this work and integrate it on my repository method?