public OperationResponse Execute(ObjectContext context)
		{
			d.ProcessTemplate template = null;

			Processor processor = new Processor().SetResponse(_response)
			#region step #1 get context
			.Then((p) => { _context = (d.SopheonEntities)context; })
			#endregion

			#region step #2 get stuff
			.Then((p) => {
				template = _context.ProcessTemplates.FirstOrDefault(x => x.Id.Equals(_request.TemplateId) || (_request.TemplateId <= 0 && x.Name.Equals(_request.Name)));
				
				p.Evaluate(!(template == null && _request.TemplateId > -1), "Model was not found!");
			})
			#endregion

			#region step #3
			.Then((p) => {
				_response.Subject = template == null ? new Domain.Entities.ProcessTemplate { Id = -1, Name = string.Empty, ProjectCount = 0 } : template.ToDomainModel();
			})
			#endregion
			;

			return _response;
		}
		public OperationResponse Execute(ObjectContext context)
		{
			d.ProcessTemplate template = null;

			Processor processor = new Processor().SetResponse(_response)
			#region step #1 get context
			.Then((p) => { _context = (d.SopheonEntities)context; })
			#endregion

			#region step #2 get stuff
			.Then((p) =>
			{
				template = _context.ProcessTemplates.FirstOrDefault(x => x.Id.Equals(_request.TemplateId));

				p.Evaluate(!(template == null && _request.TemplateId > -1), "Template was not found.");
			})
			#endregion

			#region step 3#
			.Then((p) =>
			{
				_context.ProcessTemplates.DeleteObject(template);

				_context.SaveChanges();
			});
			#endregion

			return _response;
		}
		public OperationResponse Execute(ObjectContext context)
		{
			int [] projectIds = new int[]{};

			Processor processor = new Processor().SetResponse(_response)
				#region step #1 get context
				.Then((p) => { _context = (d.SopheonEntities)context; })
				#endregion
				#region step #2 
				.Then((p) => {
					projectIds = _request.Filter.ProjectIds == null ? new int[] { } : _request.Filter.ProjectIds.Split(',').Select(x => x.ToInt()).ToArray();
				})
				#endregion
				#region step #3 get the rows
				.Then((p) => {
					List<Gate> items = new List<Gate>();
					if (projectIds.Count() > 0)
					{
						var pitems = _context.Gates.Where(x => projectIds.Contains(x.ProjectId))
							.OrderBy(x => x.Id)
							.Skip(_request.Filter.CurrentIndex).Take(_request.Filter.PageSize);

						items = pitems.ToArray()
							.Select(temp => temp.ToDomainModel()).ToList();

						var sql = ((System.Data.Objects.ObjectQuery)pitems).ToTraceString();
					}
					else {
						items = _context.Gates
							.OrderBy(x => x.Id)
							.Skip(_request.Filter.CurrentIndex).Take(_request.Filter.PageSize).ToArray()
							.Select(temp => temp.ToDomainModel()).ToList();
					}
					var count = projectIds.Count() > 0 ? _context.Gates.Count(x => projectIds.Contains(x.ProjectId)) : _context.Gates.Count();

					var list = (new PagedList<Domain.Entities.Gate> {
						Items = items,
					}).Merge(_request.Filter);

					list.TotalRecords = count;

					_response.Subject = list;

				})
				#endregion
				;

			return _response;
		}
		public OperationResponse Execute(ObjectContext context)
		{
			Processor processor = new Processor().SetResponse(_response)
				#region step #1 get context
				.Then((p) => { _context = (d.SopheonEntities)context; })
				#endregion

				#region step #2 get stuff
				.Then((p) => {
					_response.Subject = _context.Gates.Where(x => x.ProjectId.Equals(_request.ProjectId)).ToArray().Select(temp => temp.ToDomainModel()).ToList();
				})
				#endregion
				;

			return _response;
		}
        public OperationResponse Execute(ObjectContext context)
        {

            Processor processor = new Processor().SetResponse(_response)
            #region step #1 get context
            .Then((p) => { _context = (d.SopheonEntities)context; })
            #endregion

            #region step #2 get stuff
            .Then((p) =>
            {
                var templates = _context.ProcessTemplates.ToArray().Select(x => x.ToDomainModel()).ToList();

                _response.Subject = templates;
            })
            #endregion
            ;

            return _response;
        }