public ActionResult Submit(UserTaskViewModel viewModelTask)
 {
     var task = new UserTask
     {
         Title = viewModelTask.Title,
         Description = viewModelTask.Description,
         MaximumOffer = viewModelTask.MaximumOffer,
         Submitted = DateTime.UtcNow
     };
     RavenSession.Store(task);
     return RedirectToAction("Details", new { id = task.Id });
 }
        private static UserTaskViewModel CreateTaskViewModel(UserTask task)
        {
            var userTaskBidViewModels = task.Bids == null ? new UserTaskBidViewModel[]{} : task.Bids.Select(b => new UserTaskBidViewModel
            {
                Id = b.Id, AgentId = b.Agent.Id, AgentName = b.Agent.Name, Amount = b.Amount,
            }).ToArray();

            var viewModel = new UserTaskViewModel
            {
                Id = task.Id,
                Title = task.Title,
                Description = task.Description,
                MaximumOffer = task.MaximumOffer,
                Bids = userTaskBidViewModels
            };
            return viewModel;
        }