public ManageResourcesResponse AddResources(ManageResourcesRequest request)
        {
            ManageResourcesResponse response = new ManageResourcesResponse();

            int? compId = AdapterHelper.GetCompanyId(request.CompanyName);
            if (compId == null)
            {
                throw new Exception("No company found. Try again!");
            }

            using (var context = new Company_dbEntities())
            {

                var resp = (from a in context.Resources_table where a.CompanyID == compId.Value && request.Serial == a.Serial select a).FirstOrDefault<Resources_table>();

                if (resp == null)
                {
                    resp = new Resources_table();
                    resp.NameOfDevice = request.NameOfDevice;
                    resp.Type = request.Type;
                    resp.IssuedFrom = request.IssuedFrom.ToShortDateString();
                    resp.Serial = request.Serial;
                    resp.CompanyID = compId.Value;
                    resp.EmployeeID = null;
                    resp.Deleted = false;

                    context.Resources_table.Add(resp);

                    var comp = (from a in context.Company_table where a.CompanyID == compId.Value select a).FirstOrDefault<Company_table>();

                    if (comp != null)
                        comp.ResourceCount++;

                    context.SaveChanges();
                    response.IsResourcesCreated = true;
                }
                else
                {
                    response.IsResourcesCreated = false;
                }

            }

            return response;
        }
        public ManageResourcesResponse CompanyDeleted(ManageResourcesRequest request)
        {
            ManageResourcesResponse response = new ManageResourcesResponse();

            Resources_table resource = new Resources_table();
            using (var context = new Company_dbEntities())
            {

                resource = (from a in context.Resources_table  select a).FirstOrDefault<Resources_table>();

                if (resource != null)
                {
                    context.Resources_table.Remove(resource);

                    context.SaveChanges();

                    CompanyDeleted(request);
                }

                response.DeletedCompany = true;
            }

            return response;
        }