public void Attach(TEntity entity)
 {
     try
     {
         _repository.Attach(entity);
     }
     catch (ApplicationException ex)
     {
         throw new RepositoryException("An error occured while attaching an entity.", ex);
     }
 }