public IHttpActionResult Definition()
        {
            UberDocument uberDocument = new UberDocument { Version = "1.0", Data = new List<Data>() };
            Data data = new Data();
            data.Rel = new List<string>();
            data.Rel.Add("self");
            data.Rel.Add(Request.Headers.Host + "/api");

            //string authToken = Request.Headers.Authorization.Parameter;
            List <string> allowedActions = GetAllowedActions(string.Empty);
            data.Children = GetDataElements(allowedActions, "{id}", null, null);
            uberDocument.Data.Add(data);
            string uber = JsonConvert.SerializeObject(uberDocument, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });

            return Ok(new { uber });
        }
        public IHttpActionResult GetWorkerBranch(string id)
        {
            var query = WebApiConfig.GraphClient.Cypher
                .Match("(w:Worker)-[e:WORKSIN]->(b:Branch)")
                .Where((Worker w) => w.id == id)
                .Return((w, b) => new
                {
                    worker = w.As<Worker>(),
                    branch = Return.As<string>("collect(b.number)")
                });

            var queryData = query.Results.ToList();

            var workerBranches = new List<WorkerBranch>();
            foreach (var item in queryData)
            {
                WorkerBranch workerBranch = new WorkerBranch
                {
                    workerNumber = item.worker.number,
                    firstName = item.worker.firstName,
                    lastName = item.worker.lastName,
                    BranchNumber = item.branch
                };
                workerBranches.Add(workerBranch);
            }

            UberDocument uberDocument = new UberDocument { Version = "1.0", Data = new List<Data>() };
            if (workerBranches.Count > 0)
            {
                Data data = new Data();
                data.Rel = new List<string>();
                data.Rel.Add("self");
                data.Rel.Add(Request.Headers.Host + "/api/worker/" + id + "/branch");
                List<Data> result = new List<Data>();

                foreach (WorkerBranch wb in workerBranches)
                {
                    result.Add(GetBranchData(id, wb));
                }

                data.Children = result;
                uberDocument.Data.Add(data);
            }

            string uber = JsonConvert.SerializeObject(uberDocument, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
            return Ok(new { uber });
        }
        public IHttpActionResult GetWorkerSkill(string id)
        {
            var query = WebApiConfig.GraphClient.Cypher
                .Match("(w:Worker)-[e:EXPERTIN]->(s:Skill)")
                .Where((Worker w) => w.id == id)
                .Return((w, s) => new
                {
                    worker = w.As<Worker>(),
                    skill = Return.As<string>("collect(s.name)")
                });

            var queryData = query.Results.ToList();

            var workerSkills = new List<WorkerSkill>();
            foreach (var item in queryData)
            {
                WorkerSkill workerSkill = new WorkerSkill
                {
                    workerNumber = item.worker.number,
                    firstName = item.worker.firstName,
                    lastName = item.worker.lastName,
                    skill = item.skill,
                    experience = "EXPERT"
                };
                workerSkills.Add(workerSkill);
            }

            query = WebApiConfig.GraphClient.Cypher
                .Match("(w:Worker)-[e:PROFICIENTIN]->(s:Skill)")
                .Where((Worker w) => w.id == id)
                .Return((w, s) => new
                {
                    worker = w.As<Worker>(),
                    skill = Return.As<string>("collect(s.name)")
                });

            queryData = query.Results.ToList();

            foreach (var item in queryData)
            {
                WorkerSkill workerSkill = new WorkerSkill
                {
                    workerNumber = item.worker.number,
                    firstName = item.worker.firstName,
                    lastName = item.worker.lastName,
                    skill = item.skill,
                    experience = "PROFICIENT"
                };
                workerSkills.Add(workerSkill);
            }

            UberDocument uberDocument = new UberDocument { Version = "1.0", Data = new List<Data>() };
            if (workerSkills.Count > 0)
            {
                Data data = new Data();
                data.Rel = new List<string>();
                data.Rel.Add("self");
                data.Rel.Add(Request.Headers.Host + "/api/worker/" + id + "/skill");
                List<Data> result = new List<Data>();

                foreach(WorkerSkill ws in workerSkills)
                {
                    result.Add(GetSkillData(id, ws));
                }

                data.Children = result;
                uberDocument.Data.Add(data);
            }

            string uber = JsonConvert.SerializeObject(uberDocument, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
            return Ok(new { uber });
        }
        public IHttpActionResult Read(string id)
        {
            var query = WebApiConfig.GraphClient.Cypher
                .Match("(w:Worker)")
                .Where((Worker w) => w.id == id)
                .Return(w => w.As<Worker>());

            var workers = query.Results.ToList();

            UberDocument uberDocument = new UberDocument { Version = "1.0", Data = new List<Data>() };
            Worker worker = null;
            if (workers.Count > 0)
            {
                worker = workers[0];

                Data data = new Data();
                data.Rel = new List<string>();
                data.Rel.Add("self");
                data.Rel.Add(Request.Headers.Host + "/api/worker/" + id);

                List<Data> result = new List<Data>();
                result.Add(GetReadData(id, worker));
                result.Add(GetSkillData(id, null));
                result.Add(GetBranchData(id, null));
                result.Add(GetActionData(id, Actions.Replace));
                result.Add(GetActionData(id, Actions.Remove));
                data.Children = result;
                uberDocument.Data.Add(data);
            }

            string uber = JsonConvert.SerializeObject(uberDocument, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
            return Ok(new { uber });
        }