MVVM - Using entities in ViewModels
===

I am really just starting out with MVVM, IoC and Dependency Injection and I've hit a stumbling block that I don't know how to solve but I do understand why it's happening.

I am using Castle Windsor for DI and IoC functionality and MVVM Light as my MVVM framework in a WPF application.  Using [this tutorial][1] I have managed to get Castle Windsor to create a `MainPageViewModel` that has a `IGroupRepository` injected into the constructor.  I have registered a mock implementation of this in Castle Windsor.

The following is the only other code in the `MainPageViewModel` class besides the constructor.

    public ObservableCollection<GroupViewModel> Groups
    {
        get
        {
            var groupVms = new ObservableCollection<GroupViewModel>();
            IEnumerable<Group> groups = _repository.GetAllGroups();
            foreach (Group g in groups)
            {
                var vm = new GroupViewModel(g);
                groupVms.Add(vm);
            }

            return groupVms;
        }
    }

The intention is to create a view model for each of the groups in the repository.  However, doing this causes Castle Windsor to give the following exception:

> Can't create component 'Planner.ViewModel.GroupViewModel' as it has dependencies 
    to be satisfied.
> 'Planner.ViewModel.GroupViewModel' is waiting for the following dependencies:
>
>  - Service 'Planner.Models.Group' which was not registered.



I understand this exception - Castle Windsor is responsible for constructing my view models but it has no way of handling my entity.

I have done plenty of Googling but have found very few answers or suggestions to this problem which makes me think that what I am doing is wrong.  [This Stack Overflow question][2] has two answers which suggest that having an entity on the view model is ok but I'm beginning to wonder if that's true.  Other questions, [such as this one][3] suggest that the entity should be nowhere near the view model.

What is the correct way to resolve this problem?

  [1]: http://fir3pho3nixx.blogspot.co.uk/2011/08/silverlight-mvvm-light-toolkit-and.html
  [2]: http://stackoverflow.com/questions/2720329/should-i-use-dtos-as-my-data-models-in-mvvm
  [3]: http://stackoverflow.com/questions/4147250/ef4-mvvm-expose-entities-in-viewmodel